diff --git a/Mage.Client/src/main/resources/card-pictures-tok.txt b/Mage.Client/src/main/resources/card-pictures-tok.txt index c172c971f31..2bad012c0a2 100644 --- a/Mage.Client/src/main/resources/card-pictures-tok.txt +++ b/Mage.Client/src/main/resources/card-pictures-tok.txt @@ -1096,6 +1096,16 @@ |Generate|TOK:WWK|Snake|||SnakeToken| |Generate|TOK:WWK|Soldier Ally|||JoinTheRanksSoldierToken| |Generate|TOK:WWK|Wolf|||WolfToken| +|Generate|TOK:XLN|Dinosaur|||DinosaurToken| +|Generate|TOK:XLN|Illusion|||JaceCunningCastawayIllusionToken| +|Generate|TOK:XLN|Merfolk|||MerfolkHexproofToken| +|Generate|TOK:XLN|Pirate|||PirateToken| +|Generate|TOK:XLN|Plant|||DefenderPlantToken| +|Generate|TOK:XLN|Treasure|1||TreasureToken| +|Generate|TOK:XLN|Treasure|2||TreasureToken| +|Generate|TOK:XLN|Treasure|3||TreasureToken| +|Generate|TOK:XLN|Treasure|4||TreasureToken| +|Generate|TOK:XLN|Vampire|||IxalanVampireToken| |Generate|TOK:ZEN|Angel|||AngelToken| |Generate|TOK:ZEN|Beast|||BeastToken2| |Generate|TOK:ZEN|Bird|||BirdToken| diff --git a/Mage.Common/src/main/java/mage/utils/MageVersion.java b/Mage.Common/src/main/java/mage/utils/MageVersion.java index e0c0a9435a3..5238bd4f7c5 100644 --- a/Mage.Common/src/main/java/mage/utils/MageVersion.java +++ b/Mage.Common/src/main/java/mage/utils/MageVersion.java @@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable { public final static int MAGE_VERSION_MAJOR = 1; public final static int MAGE_VERSION_MINOR = 4; public final static int MAGE_VERSION_PATCH = 26; - public final static String MAGE_VERSION_MINOR_PATCH = "V4"; + public final static String MAGE_VERSION_MINOR_PATCH = "V5"; public final static String MAGE_VERSION_INFO = ""; private final int major; diff --git a/Mage.Sets/src/mage/cards/a/AtarkaWorldRender.java b/Mage.Sets/src/mage/cards/a/AtarkaWorldRender.java index b9348f249ac..7cc32c280d6 100644 --- a/Mage.Sets/src/mage/cards/a/AtarkaWorldRender.java +++ b/Mage.Sets/src/mage/cards/a/AtarkaWorldRender.java @@ -35,14 +35,11 @@ import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.DoubleStrikeAbility; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.TrampleAbility; -import mage.abilities.text.TextPartSubType; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.TextPartSubtypePredicate; -import mage.filter.predicate.permanent.TappedPredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -68,11 +65,7 @@ public class AtarkaWorldRender extends CardImpl { this.addAbility(TrampleAbility.getInstance()); // Whenever a Dragon you control attacks, it gains double strike until end of turn. - TextPartSubType textPart1 = (TextPartSubType) addTextPart(new TextPartSubType(SubType.DRAGON)); - FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Dragon you control"); - filter.add(new TextPartSubtypePredicate(textPart1)); - filter.add(Predicates.not(new TappedPredicate())); - this.addAbility(new AtarkaWorldRenderEffect(filter)); + this.addAbility(new AtarkaWorldRenderEffect()); } @@ -88,16 +81,18 @@ public class AtarkaWorldRender extends CardImpl { class AtarkaWorldRenderEffect extends TriggeredAbilityImpl { - FilterControlledCreaturePermanent filter; + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("dragon you control"); - public AtarkaWorldRenderEffect(FilterControlledCreaturePermanent filter) { + static { + filter.add(new SubtypePredicate(SubType.DRAGON)); + } + + public AtarkaWorldRenderEffect() { super(Zone.BATTLEFIELD, new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn)); - this.filter = filter; } public AtarkaWorldRenderEffect(final AtarkaWorldRenderEffect ability) { super(ability); - this.filter = ability.filter.copy(); } @Override diff --git a/Mage.Sets/src/mage/cards/b/Backslide.java b/Mage.Sets/src/mage/cards/b/Backslide.java new file mode 100644 index 00000000000..deaf789121d --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/Backslide.java @@ -0,0 +1,113 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.b; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect; +import mage.abilities.keyword.CyclingAbility; +import mage.abilities.keyword.MorphAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.filter.predicate.permanent.PermanentIdPredicate; +import mage.game.Game; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author TheElk801 + */ +public class Backslide extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with a morph ability"); + + static { + filter.add(new AbilityPredicate(MorphAbility.class)); + } + + public Backslide(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); + + // Turn target creature with a morph ability face down. + this.getSpellAbility().addEffect(new BackslideEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter)); + + // Cycling {U} + this.addAbility(new CyclingAbility(new ManaCostsImpl("{U}"))); + + } + + public Backslide(final Backslide card) { + super(card); + } + + @Override + public Backslide copy() { + return new Backslide(this); + } +} + +class BackslideEffect extends OneShotEffect { + + BackslideEffect() { + super(Outcome.Benefit); + this.staticText = "Turn target creature with a morph ability face down."; + } + + BackslideEffect(final BackslideEffect effect) { + super(effect); + } + + @Override + public BackslideEffect copy() { + return new BackslideEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Predicate pred = new PermanentIdPredicate(UUID.randomUUID()); + for (Target target : source.getTargets()) { + for (UUID targetId : target.getTargets()) { + pred = Predicates.or(pred, new PermanentIdPredicate(targetId)); + } + } + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(pred); + game.addEffect(new BecomesFaceDownCreatureAllEffect(filter), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/b/BehindTheScenes.java b/Mage.Sets/src/mage/cards/b/BehindTheScenes.java index 49aca371a86..2433120f344 100644 --- a/Mage.Sets/src/mage/cards/b/BehindTheScenes.java +++ b/Mage.Sets/src/mage/cards/b/BehindTheScenes.java @@ -52,7 +52,7 @@ public class BehindTheScenes extends CardImpl { // Creatures you control have skulk. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new GainAbilityControlledEffect(SkulkAbility.getInstance(), Duration.WhileOnBattlefield, FILTER_PERMANENT_CREATURES))); + new GainAbilityControlledEffect(new SkulkAbility(), Duration.WhileOnBattlefield, FILTER_PERMANENT_CREATURES))); // {4}{W}: Creatures you control get +1/+1 until end of turn. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, diff --git a/Mage.Sets/src/mage/cards/b/BloodOath.java b/Mage.Sets/src/mage/cards/b/BloodOath.java new file mode 100644 index 00000000000..d90fc318075 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BloodOath.java @@ -0,0 +1,145 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.b; + +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.UUID; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author TheElk801 + */ +public class BloodOath extends CardImpl { + + public BloodOath(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}"); + + // Choose a card type. Target opponent reveals his or her hand. Blood Oath deals 3 damage to that player for each card of the chosen type revealed this way. + this.getSpellAbility().addEffect(new BloodOathEffect()); + } + + public BloodOath(final BloodOath card) { + super(card); + } + + @Override + public BloodOath copy() { + return new BloodOath(this); + } +} + +class BloodOathEffect extends OneShotEffect { + + private static final Set choice = new LinkedHashSet<>(); + + static { + choice.add(CardType.ARTIFACT.toString()); + choice.add(CardType.CREATURE.toString()); + choice.add(CardType.ENCHANTMENT.toString()); + choice.add(CardType.INSTANT.toString()); + choice.add(CardType.LAND.toString()); + choice.add(CardType.PLANESWALKER.toString()); + choice.add(CardType.SORCERY.toString()); + choice.add(CardType.TRIBAL.toString()); + } + + public BloodOathEffect() { + super(Outcome.Benefit); + staticText = "Choose a card type. Target opponent reveals his or her hand. {this} deals 3 damage to that player for each card of the chosen type revealed this way"; + } + + public BloodOathEffect(final BloodOathEffect effect) { + super(effect); + } + + @Override + public BloodOathEffect copy() { + return new BloodOathEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + MageObject sourceObject = game.getObject(source.getSourceId()); + Player player = game.getPlayer(source.getControllerId()); + Player opponent = game.getPlayer(source.getFirstTarget()); + if (player != null && opponent != null && sourceObject != null) { + Choice choiceImpl = new ChoiceImpl(); + choiceImpl.setChoices(choice); + while (player.canRespond() && !player.choose(Outcome.Neutral, choiceImpl, game)) { + } + CardType type = null; + String choosenType = choiceImpl.getChoice(); + + if (choosenType.equals(CardType.ARTIFACT.toString())) { + type = CardType.ARTIFACT; + } else if (choosenType.equals(CardType.LAND.toString())) { + type = CardType.LAND; + } else if (choosenType.equals(CardType.CREATURE.toString())) { + type = CardType.CREATURE; + } else if (choosenType.equals(CardType.ENCHANTMENT.toString())) { + type = CardType.ENCHANTMENT; + } else if (choosenType.equals(CardType.INSTANT.toString())) { + type = CardType.INSTANT; + } else if (choosenType.equals(CardType.SORCERY.toString())) { + type = CardType.SORCERY; + } else if (choosenType.equals(CardType.PLANESWALKER.toString())) { + type = CardType.PLANESWALKER; + } else if (choosenType.equals(CardType.TRIBAL.toString())) { + type = CardType.TRIBAL; + } + if (type != null) { + Cards hand = opponent.getHand(); + opponent.revealCards(sourceObject.getIdName(), hand, game); + Set cards = hand.getCards(game); + int count = 0; + for (Card card : cards) { + if (card != null && card.getCardType().contains(type)) { + count += 1; + } + } + opponent.damage(count * 3, source.getSourceId(), game, false, true); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/b/BloodbondMarch.java b/Mage.Sets/src/mage/cards/b/BloodbondMarch.java index da7b086ba98..de0ab798e89 100644 --- a/Mage.Sets/src/mage/cards/b/BloodbondMarch.java +++ b/Mage.Sets/src/mage/cards/b/BloodbondMarch.java @@ -85,7 +85,7 @@ public class BloodbondMarch extends CardImpl { return false; } - Spell spell = (Spell) game.getStack().getStackObject(targetPointer.getFirst(game, source)); + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell == null) { return false; diff --git a/Mage.Sets/src/mage/cards/b/BounteousKirin.java b/Mage.Sets/src/mage/cards/b/BounteousKirin.java index afcd8911c14..5a3ae7a8fac 100644 --- a/Mage.Sets/src/mage/cards/b/BounteousKirin.java +++ b/Mage.Sets/src/mage/cards/b/BounteousKirin.java @@ -48,7 +48,7 @@ import mage.players.Player; public class BounteousKirin extends CardImpl { public BounteousKirin(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.KIRIN, SubType.SPIRIT); @@ -89,7 +89,7 @@ class BounteousKirinEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getState().getStack().getSpell(getTargetPointer().getFirst(game, source)); + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell != null) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/cards/c/CelestialKirin.java b/Mage.Sets/src/mage/cards/c/CelestialKirin.java index 678da2418de..3082e74b94d 100644 --- a/Mage.Sets/src/mage/cards/c/CelestialKirin.java +++ b/Mage.Sets/src/mage/cards/c/CelestialKirin.java @@ -50,7 +50,7 @@ import mage.game.stack.Spell; public class CelestialKirin extends CardImpl { public CelestialKirin(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.KIRIN); this.subtype.add(SubType.SPIRIT); @@ -92,7 +92,7 @@ class CelestialKirinEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getState().getStack().getSpell(getTargetPointer().getFirst(game, source)); + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell != null) { int cmc = spell.getConvertedManaCost(); FilterPermanent filter = new FilterPermanent(); diff --git a/Mage.Sets/src/mage/cards/c/ChandraTheFirebrand.java b/Mage.Sets/src/mage/cards/c/ChandraTheFirebrand.java index e98cd3a959d..1d474d1b251 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraTheFirebrand.java +++ b/Mage.Sets/src/mage/cards/c/ChandraTheFirebrand.java @@ -91,7 +91,7 @@ public class ChandraTheFirebrand extends CardImpl { class ChandraTheFirebrandAbility extends DelayedTriggeredAbility { ChandraTheFirebrandAbility() { - super(new CopyTargetSpellEffect(), Duration.EndOfTurn); + super(new CopyTargetSpellEffect(true), Duration.EndOfTurn); } ChandraTheFirebrandAbility(final ChandraTheFirebrandAbility ability) { diff --git a/Mage.Sets/src/mage/cards/c/CloudhoofKirin.java b/Mage.Sets/src/mage/cards/c/CloudhoofKirin.java index 8cc24f3b144..2494270a629 100644 --- a/Mage.Sets/src/mage/cards/c/CloudhoofKirin.java +++ b/Mage.Sets/src/mage/cards/c/CloudhoofKirin.java @@ -54,7 +54,7 @@ import mage.target.TargetPlayer; public class CloudhoofKirin extends CardImpl { public CloudhoofKirin(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.KIRIN); this.subtype.add(SubType.SPIRIT); @@ -98,10 +98,10 @@ class CloudhoofKirinEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell != null) { Player targetPlayer = null; - for(Target target: source.getTargets()) { + for (Target target : source.getTargets()) { if (target instanceof TargetPlayer) { targetPlayer = game.getPlayer(target.getFirstTarget()); } diff --git a/Mage.Sets/src/mage/cards/c/ClovenCasting.java b/Mage.Sets/src/mage/cards/c/ClovenCasting.java index eea8864f432..107ed2c49da 100644 --- a/Mage.Sets/src/mage/cards/c/ClovenCasting.java +++ b/Mage.Sets/src/mage/cards/c/ClovenCasting.java @@ -60,7 +60,7 @@ public class ClovenCasting extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{5}{U}{R}"); // Whenever you cast a multicolored instant or sorcery spell, you may pay {1}. If you do, copy that spell. You may choose new targets for the copy. - Effect effect = new CopyTargetSpellEffect(); + Effect effect = new CopyTargetSpellEffect(true); effect.setText("copy that spell. You may choose new targets for the copy"); this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(effect, new GenericManaCost(1)), filter, true, true)); } diff --git a/Mage.Sets/src/mage/cards/c/CulturalExchange.java b/Mage.Sets/src/mage/cards/c/CulturalExchange.java new file mode 100644 index 00000000000..bb81b4b40a7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CulturalExchange.java @@ -0,0 +1,136 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.c; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author TheElk801 + */ +public class CulturalExchange extends CardImpl { + + public CulturalExchange(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}"); + + // Choose any number of creatures target player controls. Choose the same number of creatures another target player controls. Those players exchange control of those creatures. + this.getSpellAbility().addEffect(new CulturalExchangeEffect()); + this.getSpellAbility().addTarget(new TargetPlayer(2)); + } + + public CulturalExchange(final CulturalExchange card) { + super(card); + } + + @Override + public CulturalExchange copy() { + return new CulturalExchange(this); + } +} + +class CulturalExchangeEffect extends OneShotEffect { + + CulturalExchangeEffect() { + super(Outcome.Benefit); + this.staticText = "Choose any number of creatures target player controls. " + + "Choose the same number of creatures another target player controls. " + + "Those players exchange control of those creatures."; + } + + CulturalExchangeEffect(final CulturalExchangeEffect effect) { + super(effect); + } + + @Override + public CulturalExchangeEffect copy() { + return new CulturalExchangeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player1 = game.getPlayer(targetPointer.getTargets(game, source).get(0)); + Player player2 = game.getPlayer(targetPointer.getTargets(game, source).get(1)); + Player controller = game.getPlayer(source.getControllerId()); + if (player1 == null || player2 == null || controller == null) { + return false; + } + FilterCreaturePermanent filter1 = new FilterCreaturePermanent("creatures " + player1.getLogName() + " controls"); + FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creatures " + player2.getLogName() + " controls"); + filter1.add(new ControllerIdPredicate(player1.getId())); + filter2.add(new ControllerIdPredicate(player2.getId())); + int creatureCount1 = game.getBattlefield().count(filter1, source.getSourceId(), source.getControllerId(), game); + int creatureCount2 = game.getBattlefield().count(filter2, source.getSourceId(), source.getControllerId(), game); + int creaturesToSwitch = Math.min(creatureCount1, creatureCount2); + if (creaturesToSwitch == 0) { + return true; + } + TargetCreaturePermanent target1 = new TargetCreaturePermanent(0, creaturesToSwitch, filter1, true); + if (target1.choose(Outcome.Benefit, controller.getId(), source.getSourceId(), game)) { + int otherToSwitch = target1.getTargets().size(); + TargetCreaturePermanent target2 = new TargetCreaturePermanent(otherToSwitch, otherToSwitch, filter2, true); + if (target2.choose(Outcome.Benefit, controller.getId(), source.getSourceId(), game)) { + for (UUID creatureId : target1.getTargets()) { + Permanent creature = game.getPermanent(creatureId); + if (creature != null) { + ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, player2.getId()); + game.informPlayers(player2.getLogName() + " gains control of " + creature.getLogName()); + effect.setTargetPointer(new FixedTarget(creature, game)); + game.addEffect(effect, source); + } + } + for (UUID creatureId : target2.getTargets()) { + Permanent creature = game.getPermanent(creatureId); + if (creature != null) { + ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, player1.getId()); + game.informPlayers(player1.getLogName() + " gains control of " + creature.getLogName()); + effect.setTargetPointer(new FixedTarget(creature, game)); + game.addEffect(effect, source); + } + } + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java b/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java index b7f238deb80..96e43762b90 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfEchoes.java @@ -58,7 +58,7 @@ import mage.target.targetpointer.FixedTarget; public class CurseOfEchoes extends CardImpl { public CurseOfEchoes(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}"); this.subtype.add(SubType.AURA, SubType.CURSE); // Enchant player @@ -143,7 +143,7 @@ class CurseOfEchoesEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell != null) { String chooseMessage = "Copy target spell? You may choose new targets for the copy."; for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { diff --git a/Mage.Sets/src/mage/cards/c/CyclonicRift.java b/Mage.Sets/src/mage/cards/c/CyclonicRift.java index b9c1262408a..826f7606dcd 100644 --- a/Mage.Sets/src/mage/cards/c/CyclonicRift.java +++ b/Mage.Sets/src/mage/cards/c/CyclonicRift.java @@ -28,21 +28,17 @@ package mage.cards.c; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.keyword.OverloadAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.TargetController; -import mage.constants.Zone; import mage.filter.common.FilterNonlandPermanent; import mage.filter.predicate.permanent.ControllerPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.common.TargetNonlandPermanent; /** @@ -58,14 +54,16 @@ public class CyclonicRift extends CardImpl { } public CyclonicRift(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); // Return target nonland permanent you don't control to its owner's hand. this.getSpellAbility().addTarget(new TargetNonlandPermanent(filter)); this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); // Overload {6}{U} (You may cast this spell for its overload cost. If you do, change its text by replacing all instances of "target" with "each.") - this.addAbility(new OverloadAbility(this, new CyclonicRiftEffect(), new ManaCostsImpl("{6}{U}"))); + Effect effect = new ReturnToHandFromBattlefieldAllEffect(filter); + effect.setText("Return each nonland permanent you don't control to its owner's hand"); + this.addAbility(new OverloadAbility(this, effect, new ManaCostsImpl("{6}{U}"))); } public CyclonicRift(final CyclonicRift card) { @@ -77,33 +75,3 @@ public class CyclonicRift extends CardImpl { return new CyclonicRift(this); } } - -class CyclonicRiftEffect extends OneShotEffect { - - private static final FilterNonlandPermanent filter = new FilterNonlandPermanent(); - - public CyclonicRiftEffect() { - super(Outcome.ReturnToHand); - staticText = "Return each nonland permanent you don't control to its owner's hand"; - } - - public CyclonicRiftEffect(final CyclonicRiftEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - if (!creature.getControllerId().equals(source.getControllerId())) { - creature.moveToZone(Zone.HAND, source.getSourceId(), game, true); - } - - } - return true; - } - - @Override - public CyclonicRiftEffect copy() { - return new CyclonicRiftEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/d/Dovescape.java b/Mage.Sets/src/mage/cards/d/Dovescape.java index 1b97b32810c..2b8e339aa4d 100644 --- a/Mage.Sets/src/mage/cards/d/Dovescape.java +++ b/Mage.Sets/src/mage/cards/d/Dovescape.java @@ -36,7 +36,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SetTargetPointer; -import mage.constants.Zone; import mage.filter.FilterSpell; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; @@ -92,12 +91,9 @@ class DovescapeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source)); + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); int spellCMC = 0; UUID spellControllerID = null; - if (spell == null) { - spell = (Spell) game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.STACK); - } if (spell != null) { spellCMC = spell.getConvertedManaCost(); spellControllerID = spell.getControllerId(); diff --git a/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java b/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java index 2f1783b3258..6fd7248a7e7 100644 --- a/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java +++ b/Mage.Sets/src/mage/cards/d/DuskmantleSeer.java @@ -40,6 +40,7 @@ import mage.constants.Outcome; import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.players.Player; /** @@ -49,7 +50,7 @@ import mage.players.Player; public class DuskmantleSeer extends CardImpl { public DuskmantleSeer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}"); this.subtype.add(SubType.VAMPIRE); this.subtype.add(SubType.WIZARD); @@ -91,15 +92,15 @@ class DuskmantleSeerEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Card sourceCard = game.getCard(source.getSourceId()); + Permanent sourceCard = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourceCard == null) { return false; } - for (Player player: game.getPlayers().values()) { - if(player.getLibrary().hasCards()){ + for (Player player : game.getPlayers().values()) { + if (player.getLibrary().hasCards()) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { - Cards cards = new CardsImpl(); + Cards cards = new CardsImpl(); cards.add(card); player.revealCards(sourceCard.getName() + ": Revealed by " + player.getName(), cards, game); player.loseLife(card.getConvertedManaCost(), game, false); diff --git a/Mage.Sets/src/mage/cards/e/EndrekSahrMasterBreeder.java b/Mage.Sets/src/mage/cards/e/EndrekSahrMasterBreeder.java index 8ee17fad26b..931f6885b01 100644 --- a/Mage.Sets/src/mage/cards/e/EndrekSahrMasterBreeder.java +++ b/Mage.Sets/src/mage/cards/e/EndrekSahrMasterBreeder.java @@ -43,7 +43,6 @@ import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.token.ThrullToken; import mage.game.stack.Spell; -import mage.target.targetpointer.FixedTarget; /** * @author LevelX2 @@ -95,10 +94,7 @@ class EndrekSahrMasterBreederEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); - if (spell == null) { - spell = (Spell) game.getLastKnownInformation(((FixedTarget) getTargetPointer()).getTarget(), Zone.STACK); - } + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell != null) { int cmc = spell.getConvertedManaCost(); if (cmc > 0) { diff --git a/Mage.Sets/src/mage/cards/e/EntrancingMelody.java b/Mage.Sets/src/mage/cards/e/EntrancingMelody.java index 8a49d375f06..04eed25ce3a 100644 --- a/Mage.Sets/src/mage/cards/e/EntrancingMelody.java +++ b/Mage.Sets/src/mage/cards/e/EntrancingMelody.java @@ -48,7 +48,7 @@ import mage.target.common.TargetCreaturePermanent; public class EntrancingMelody extends CardImpl { public EntrancingMelody(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{U}{U}"); // Gain control of target creature with converted mana cost X. this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.Custom, true)); diff --git a/Mage.Sets/src/mage/cards/f/FarbogRevenant.java b/Mage.Sets/src/mage/cards/f/FarbogRevenant.java index 6e4a727a08b..3bdfb80d93c 100644 --- a/Mage.Sets/src/mage/cards/f/FarbogRevenant.java +++ b/Mage.Sets/src/mage/cards/f/FarbogRevenant.java @@ -49,7 +49,7 @@ public class FarbogRevenant extends CardImpl { this.toughness = new MageInt(3); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // Lifelink this.addAbility(LifelinkAbility.getInstance()); diff --git a/Mage.Sets/src/mage/cards/f/FleshReaver.java b/Mage.Sets/src/mage/cards/f/FleshReaver.java new file mode 100644 index 00000000000..eb5448509d2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FleshReaver.java @@ -0,0 +1,146 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.f; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author TheElk801 + */ +public class FleshReaver extends CardImpl { + + public FleshReaver(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); + + this.subtype.add(SubType.HORROR); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Whenever Flesh Reaver deals damage to a creature or opponent, Flesh Reaver deals that much damage to you. + this.addAbility(new FleshReaverTriggeredAbility()); + } + + public FleshReaver(final FleshReaver card) { + super(card); + } + + @Override + public FleshReaver copy() { + return new FleshReaver(this); + } +} + +class FleshReaverTriggeredAbility extends TriggeredAbilityImpl { + + FleshReaverTriggeredAbility() { + super(Zone.BATTLEFIELD, new FleshReaverEffect()); + } + + FleshReaverTriggeredAbility(final FleshReaverTriggeredAbility effect) { + super(effect); + } + + @Override + public FleshReaverTriggeredAbility copy() { + return new FleshReaverTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGED_CREATURE || event.getType() == GameEvent.EventType.DAMAGED_PLAYER; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!event.getSourceId().equals(sourceId)) { + return false; + } + if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { + if (event.getTargetId().equals(controllerId)) { + return false; + } + } + for (Effect effect : this.getEffects()) { + effect.setValue("damage", event.getAmount()); + } + return true; + } + + @Override + public String getRule() { + return "Whenever {this} deals damage to a creature or opponent, {this} deals that much damage to you."; + } + +} + +class FleshReaverEffect extends OneShotEffect { + + FleshReaverEffect() { + super(Outcome.Detriment); + this.staticText = "{this} deals that much damage to you."; + } + + FleshReaverEffect(final FleshReaverEffect effect) { + super(effect); + } + + @Override + public FleshReaverEffect copy() { + return new FleshReaverEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent creature = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (creature == null || controller == null) { + return false; + } + int damageToDeal = (Integer) getValue("damage"); + if (damageToDeal > 0) { + controller.damage(damageToDeal, source.getSourceId(), game, false, true); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/f/Fogwalker.java b/Mage.Sets/src/mage/cards/f/Fogwalker.java index 5ae28940207..eaf42be950e 100644 --- a/Mage.Sets/src/mage/cards/f/Fogwalker.java +++ b/Mage.Sets/src/mage/cards/f/Fogwalker.java @@ -60,7 +60,7 @@ public class Fogwalker extends CardImpl { this.toughness = new MageInt(3); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // When Fogwalker enters the battlefield, target creature an opponent controls doesn't untap during it controler's next untap step. EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DontUntapInControllersNextUntapStepTargetEffect()); ability.addTarget(new TargetCreaturePermanent(filter)); diff --git a/Mage.Sets/src/mage/cards/f/ForgottenCreation.java b/Mage.Sets/src/mage/cards/f/ForgottenCreation.java index f5435fdc02b..37bfc59efe3 100644 --- a/Mage.Sets/src/mage/cards/f/ForgottenCreation.java +++ b/Mage.Sets/src/mage/cards/f/ForgottenCreation.java @@ -56,7 +56,7 @@ public class ForgottenCreation extends CardImpl { this.toughness = new MageInt(3); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // At the beginning of your upkeep, you may discard all the cards in your hand. If you do, draw that many cards. this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ForgottenCreationEffect(), TargetController.YOU, true)); } diff --git a/Mage.Sets/src/mage/cards/f/FurtiveHomunculus.java b/Mage.Sets/src/mage/cards/f/FurtiveHomunculus.java index 11fc20bf02a..de4abdb0944 100644 --- a/Mage.Sets/src/mage/cards/f/FurtiveHomunculus.java +++ b/Mage.Sets/src/mage/cards/f/FurtiveHomunculus.java @@ -48,7 +48,7 @@ public class FurtiveHomunculus extends CardImpl { this.toughness = new MageInt(1); // Skulk (This creature can't be blocked by creatures with greater power.) - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); } public FurtiveHomunculus(final FurtiveHomunculus card) { diff --git a/Mage.Sets/src/mage/cards/g/GamePreserve.java b/Mage.Sets/src/mage/cards/g/GamePreserve.java new file mode 100644 index 00000000000..300ed6a40a6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GamePreserve.java @@ -0,0 +1,113 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.g; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author TheElk801 + */ +public class GamePreserve extends CardImpl { + + public GamePreserve(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); + + // At the beginning of your upkeep, each player reveals the top card of his or her library. If all cards revealed this way are creature cards, put those cards onto the battlefield under their owners' control. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DuskmarEffect(), TargetController.YOU, false)); + } + + public GamePreserve(final GamePreserve card) { + super(card); + } + + @Override + public GamePreserve copy() { + return new GamePreserve(this); + } +} + +class DuskmarEffect extends OneShotEffect { + + public DuskmarEffect() { + super(Outcome.Detriment); + this.staticText = "each player reveals the top card of his or her library. If all cards revealed this way are creature cards, put those cards onto the battlefield under their owners' control"; + } + + public DuskmarEffect(final DuskmarEffect effect) { + super(effect); + } + + @Override + public DuskmarEffect copy() { + return new DuskmarEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent sourceCard = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (sourceCard == null) { + return false; + } + boolean putToPlay = true; + Cards cards = new CardsImpl(); + for (Player player : game.getPlayers().values()) { + if (player.getLibrary().hasCards()) { + Card card = player.getLibrary().removeFromTop(game); + if (card != null) { + cards.add(card); + if (!card.isCreature()) { + putToPlay = false; + } + player.revealCards(sourceCard.getName() + ": Revealed by " + player.getName(), cards, game); + } + } else { + putToPlay = false; + } + } + if (putToPlay) { + game.getPlayers().values().iterator().next().moveCards(cards.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/g/GeminiEngine.java b/Mage.Sets/src/mage/cards/g/GeminiEngine.java new file mode 100644 index 00000000000..d7939a3a13d --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GeminiEngine.java @@ -0,0 +1,117 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.g; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SacrificeTargetEffect; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.GeminiEngineTwinToken; +import mage.game.permanent.token.Token; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author TheElk801 + */ +public class GeminiEngine extends CardImpl { + + public GeminiEngine(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}"); + + this.subtype.add(SubType.CONSTRUCT); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Whenever Gemini Engine attacks, create a colorless Construct artifact creature token named Twin that's attacking. Its power is equal to Gemini Engine's power and its toughness is equal to Gemini Engine's toughness. Sacrifice the token at end of combat. + this.addAbility(new AttacksTriggeredAbility(new GeminiEngineCreateTokenEffect(), false)); + } + + public GeminiEngine(final GeminiEngine card) { + super(card); + } + + @Override + public GeminiEngine copy() { + return new GeminiEngine(this); + } +} + +class GeminiEngineCreateTokenEffect extends OneShotEffect { + + GeminiEngineCreateTokenEffect() { + super(Outcome.Benefit); + this.staticText = "create a colorless Construct artifact creature token named Twin that's attacking. Its power is equal to {this}'s power and its toughness is equal to {this}'s toughness. Sacrifice the token at end of combat."; + } + + GeminiEngineCreateTokenEffect(final GeminiEngineCreateTokenEffect effect) { + super(effect); + } + + @Override + public GeminiEngineCreateTokenEffect copy() { + return new GeminiEngineCreateTokenEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); + Token token; + if (permanent != null) { + token = new GeminiEngineTwinToken(permanent.getPower().getValue(), permanent.getToughness().getValue()); + } else { + token = new GeminiEngineTwinToken(0, 0); + } + token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, true); + for (UUID tokenId : token.getLastAddedTokenIds()) { + Permanent tokenPerm = game.getPermanent(tokenId); + if (tokenPerm != null) { + Effect effect = new SacrificeTargetEffect("sacrifice " + tokenPerm.getLogName(), player.getId()); + effect.setTargetPointer(new FixedTarget(tokenPerm, game)); + game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(effect), source); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/h/HiveMind.java b/Mage.Sets/src/mage/cards/h/HiveMind.java index d0694c38012..a2549bea8d0 100644 --- a/Mage.Sets/src/mage/cards/h/HiveMind.java +++ b/Mage.Sets/src/mage/cards/h/HiveMind.java @@ -50,7 +50,7 @@ import mage.target.targetpointer.FixedTarget; public class HiveMind extends CardImpl { public HiveMind(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{5}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{U}"); // Whenever a player casts an instant or sorcery spell, each other player copies that spell. Each of those players may choose new targets for his or her copy. this.addAbility(new HiveMindTriggeredAbility()); @@ -125,11 +125,7 @@ class HiveMindEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell; - spell = game.getStack().getSpell(((FixedTarget) getTargetPointer()).getTarget()); - if (spell == null) { // if spell e.g. was countered - spell = (Spell) game.getLastKnownInformation(((FixedTarget) getTargetPointer()).getTarget(), Zone.STACK); - } + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); Player player = game.getPlayer(source.getControllerId()); if (spell != null && player != null) { for (UUID playerId : game.getState().getPlayersInRange(player.getId(), game)) { diff --git a/Mage.Sets/src/mage/cards/h/HowlOfTheHorde.java b/Mage.Sets/src/mage/cards/h/HowlOfTheHorde.java index 5dba37f4c3c..d6e46210fa7 100644 --- a/Mage.Sets/src/mage/cards/h/HowlOfTheHorde.java +++ b/Mage.Sets/src/mage/cards/h/HowlOfTheHorde.java @@ -77,7 +77,7 @@ public class HowlOfTheHorde extends CardImpl { class HowlOfTheHordeDelayedTriggeredAbility extends DelayedTriggeredAbility { HowlOfTheHordeDelayedTriggeredAbility() { - super(new CopyTargetSpellEffect(), Duration.EndOfTurn); + super(new CopyTargetSpellEffect(true), Duration.EndOfTurn); } HowlOfTheHordeDelayedTriggeredAbility(final HowlOfTheHordeDelayedTriggeredAbility ability) { diff --git a/Mage.Sets/src/mage/cards/i/InfernalKirin.java b/Mage.Sets/src/mage/cards/i/InfernalKirin.java index 90104521c5f..8ac95b840b8 100644 --- a/Mage.Sets/src/mage/cards/i/InfernalKirin.java +++ b/Mage.Sets/src/mage/cards/i/InfernalKirin.java @@ -55,7 +55,7 @@ import mage.target.TargetPlayer; public class InfernalKirin extends CardImpl { public InfernalKirin(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.KIRIN); this.subtype.add(SubType.SPIRIT); @@ -100,11 +100,11 @@ class InfernalKirinEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell != null) { int cmc = spell.getConvertedManaCost(); Player targetPlayer = null; - for(Target target: source.getTargets()) { + for (Target target : source.getTargets()) { if (target instanceof TargetPlayer) { targetPlayer = game.getPlayer(target.getFirstTarget()); } @@ -112,7 +112,7 @@ class InfernalKirinEffect extends OneShotEffect { if (targetPlayer != null) { if (!targetPlayer.getHand().isEmpty()) { targetPlayer.revealCards("Infernal Kirin", targetPlayer.getHand(), game); - for (UUID uuid: targetPlayer.getHand().copy()) { + for (UUID uuid : targetPlayer.getHand().copy()) { Card card = game.getCard(uuid); if (card != null && card.getConvertedManaCost() == cmc) { targetPlayer.discard(card, source, game); diff --git a/Mage.Sets/src/mage/cards/i/IxalansBinding.java b/Mage.Sets/src/mage/cards/i/IxalansBinding.java index 0e562625f03..1e41ce332e2 100644 --- a/Mage.Sets/src/mage/cards/i/IxalansBinding.java +++ b/Mage.Sets/src/mage/cards/i/IxalansBinding.java @@ -107,6 +107,9 @@ class IxalansBindingReplacementEffect extends ContinuousRuleModifyingEffectImpl public boolean applies(GameEvent event, Ability source, Game game) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Card card = game.getCard(event.getSourceId()); + if(event.getPlayerId().equals(source.getControllerId())){ + return false; + } if (sourcePermanent != null && card != null) { UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); if (exileZone != null) { diff --git a/Mage.Sets/src/mage/cards/k/KaervekTheMerciless.java b/Mage.Sets/src/mage/cards/k/KaervekTheMerciless.java index fb626204b33..a196c1f169a 100644 --- a/Mage.Sets/src/mage/cards/k/KaervekTheMerciless.java +++ b/Mage.Sets/src/mage/cards/k/KaervekTheMerciless.java @@ -29,7 +29,6 @@ package mage.cards.k; import java.util.UUID; import mage.MageInt; -import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.SpellCastOpponentTriggeredAbility; import mage.abilities.effects.OneShotEffect; @@ -51,7 +50,7 @@ import mage.target.common.TargetCreatureOrPlayer; public class KaervekTheMerciless extends CardImpl { public KaervekTheMerciless(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{R}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SHAMAN); @@ -94,9 +93,9 @@ class KaervekTheMercilessEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - MageObject spellCast = game.getObject(getTargetPointer().getFirst(game, source)); - if (spellCast instanceof Spell) { - int cost = ((Spell) spellCast).getConvertedManaCost(); + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); + if (spell != null) { + int cost = spell.getConvertedManaCost(); Player target = game.getPlayer(source.getFirstTarget()); if (target != null) { target.damage(cost, source.getSourceId(), game, false, true); diff --git a/Mage.Sets/src/mage/cards/m/MasterOfTheVeil.java b/Mage.Sets/src/mage/cards/m/MasterOfTheVeil.java new file mode 100644 index 00000000000..47969292318 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MasterOfTheVeil.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.cards.m; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility; +import mage.constants.SubType; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect; +import mage.abilities.keyword.MorphAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.filter.predicate.permanent.PermanentIdPredicate; +import mage.game.Game; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author TheElk801 + */ +public class MasterOfTheVeil extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with a morph ability"); + + static { + filter.add(new AbilityPredicate(MorphAbility.class)); + } + + public MasterOfTheVeil(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Morph {2}{U} + this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}{U}"))); + + // When Master of the Veil is turned face up, you may turn target creature with a morph ability face down. + Ability ability = new TurnedFaceUpSourceTriggeredAbility(new MasterOfTheVeilEffect(), false, true); + ability.addTarget(new TargetCreaturePermanent(1, 1, filter, false)); + this.addAbility(ability); + } + + public MasterOfTheVeil(final MasterOfTheVeil card) { + super(card); + } + + @Override + public MasterOfTheVeil copy() { + return new MasterOfTheVeil(this); + } +} + +class MasterOfTheVeilEffect extends OneShotEffect { + + MasterOfTheVeilEffect() { + super(Outcome.Benefit); + this.staticText = "turn target creature with a morph ability face down"; + } + + MasterOfTheVeilEffect(final MasterOfTheVeilEffect effect) { + super(effect); + } + + @Override + public MasterOfTheVeilEffect copy() { + return new MasterOfTheVeilEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Predicate pred = new PermanentIdPredicate(UUID.randomUUID()); + for (Target target : source.getTargets()) { + for (UUID targetId : target.getTargets()) { + pred = Predicates.or(pred, new PermanentIdPredicate(targetId)); + } + } + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(pred); + game.addEffect(new BecomesFaceDownCreatureAllEffect(filter), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/m/MavrenFeinDuskApostle.java b/Mage.Sets/src/mage/cards/m/MavrenFeinDuskApostle.java index bd1251ac894..5f0834f82b2 100644 --- a/Mage.Sets/src/mage/cards/m/MavrenFeinDuskApostle.java +++ b/Mage.Sets/src/mage/cards/m/MavrenFeinDuskApostle.java @@ -79,7 +79,7 @@ public class MavrenFeinDuskApostle extends CardImpl { class MavrenFeinDuskApostleTriggeredAbility extends TriggeredAbilityImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken Vampire you control"); + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken Vampires you control"); static { filter.add(new SubtypePredicate(SubType.VAMPIRE)); @@ -109,7 +109,7 @@ class MavrenFeinDuskApostleTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { for (UUID creatureId : game.getCombat().getAttackers()) { Permanent creature = game.getPermanent(creatureId); - if (creature != null && filter.match(creature, game)) { + if (creature != null && filter.match(creature, game) && creature.getControllerId().equals(controllerId)) { return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MetallurgicSummonings.java b/Mage.Sets/src/mage/cards/m/MetallurgicSummonings.java index 56c3273bad4..cdd7b429e61 100644 --- a/Mage.Sets/src/mage/cards/m/MetallurgicSummonings.java +++ b/Mage.Sets/src/mage/cards/m/MetallurgicSummonings.java @@ -51,7 +51,6 @@ import mage.game.Game; import mage.game.permanent.token.MetallurgicSummoningsConstructToken; import mage.game.stack.Spell; import mage.players.Player; -import mage.target.targetpointer.FixedTarget; /** * @@ -106,10 +105,7 @@ class MetallurgicSummoningsTokenEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); - if (spell == null) { - spell = (Spell) game.getLastKnownInformation(((FixedTarget) getTargetPointer()).getTarget(), Zone.STACK); - } + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell != null) { int cmc = spell.getConvertedManaCost(); if (cmc > 0) { diff --git a/Mage.Sets/src/mage/cards/m/MindstormCrown.java b/Mage.Sets/src/mage/cards/m/MindstormCrown.java new file mode 100644 index 00000000000..4170b7a6cdd --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MindstormCrown.java @@ -0,0 +1,143 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.m; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.WatcherScope; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.watchers.Watcher; + +/** + * + * @author TheElk801 + */ +public class MindstormCrown extends CardImpl { + + public MindstormCrown(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); + + // At the beginning of your upkeep, draw a card if you had no cards in hand at the beginning of this turn. If you had a card in hand, Mindstorm Crown deals 1 damage to you. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new MindstormCrownEffect(), TargetController.YOU, false), new MindstormCrownWatcher()); + } + + public MindstormCrown(final MindstormCrown card) { + super(card); + } + + @Override + public MindstormCrown copy() { + return new MindstormCrown(this); + } +} + +class MindstormCrownEffect extends OneShotEffect { + + MindstormCrownEffect() { + super(Outcome.Benefit); + this.staticText = ""; + } + + MindstormCrownEffect(final MindstormCrownEffect effect) { + super(effect); + } + + @Override + public MindstormCrownEffect copy() { + return new MindstormCrownEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (player == null) { + return false; + } + MindstormCrownWatcher watcher = (MindstormCrownWatcher) game.getState().getWatchers().get(MindstormCrownWatcher.class.getSimpleName()); + if (watcher != null && watcher.getCardsInHandCount() == 0) { + player.drawCards(1, game); + } else { + if (permanent != null) { + player.damage(2, permanent.getId(), game, false, true); + } + } + return true; + } +} + +class MindstormCrownWatcher extends Watcher { + + private int cardsInHandCount; + + public MindstormCrownWatcher() { + super(MindstormCrownWatcher.class.getSimpleName(), WatcherScope.GAME); + } + + public MindstormCrownWatcher(final MindstormCrownWatcher watcher) { + super(watcher); + cardsInHandCount = watcher.cardsInHandCount; + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.BEGINNING_PHASE_PRE + && game.getPhase() != null) { + Player player = game.getPlayer(game.getActivePlayerId()); + int cardsInHand = 0; + if (player != null) { + cardsInHand = player.getHand().size(); + } + cardsInHandCount = cardsInHand; + } + } + + public int getCardsInHandCount() { + return cardsInHandCount; + } + + @Override + public void reset() { + cardsInHandCount = 0; + } + + @Override + public MindstormCrownWatcher copy() { + return new MindstormCrownWatcher(this); + } +} diff --git a/Mage.Sets/src/mage/cards/m/MineLayer.java b/Mage.Sets/src/mage/cards/m/MineLayer.java new file mode 100644 index 00000000000..1c2342f6294 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MineLayer.java @@ -0,0 +1,121 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.m; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BecomesTappedTriggeredAbility; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.permanent.CounterPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetLandPermanent; + +/** + * + * @author TheElk801 + */ +public class MineLayer extends CardImpl { + + private static final FilterLandPermanent filter = new FilterLandPermanent("land with a mine counter on it"); + + static { + filter.add(new CounterPredicate(CounterType.MINE)); + } + + public MineLayer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add(SubType.DWARF); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {1}{R}, {tap}: Put a mine counter on target land. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.MINE.createInstance()), new TapSourceCost()); + ability.addCost(new ManaCostsImpl("{1}{R}")); + ability.addTarget(new TargetLandPermanent()); + this.addAbility(ability); + + // Whenever a land with a mine counter on it becomes tapped, destroy it. + this.addAbility(new BecomesTappedTriggeredAbility(new DestroyTargetEffect().setText("destroy that land"), false, filter, true)); + + // When Mine Layer leaves the battlefield, remove all mine counters from all lands. + this.addAbility(new LeavesBattlefieldTriggeredAbility(new RemoveAllMineCountersEffect(), false)); + } + + public MineLayer(final MineLayer card) { + super(card); + } + + @Override + public MineLayer copy() { + return new MineLayer(this); + } +} + +class RemoveAllMineCountersEffect extends OneShotEffect { + + public RemoveAllMineCountersEffect() { + super(Outcome.Neutral); + this.staticText = "remove all mine counters from all lands"; + } + + public RemoveAllMineCountersEffect(final RemoveAllMineCountersEffect effect) { + super(effect); + } + + @Override + public RemoveAllMineCountersEffect copy() { + return new RemoveAllMineCountersEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.LAND)) { + if (permanent != null) { + permanent.getCounters(game).removeAllCounters(CounterType.MINE); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/m/Mirari.java b/Mage.Sets/src/mage/cards/m/Mirari.java index 7a657a5fd89..f9732899095 100644 --- a/Mage.Sets/src/mage/cards/m/Mirari.java +++ b/Mage.Sets/src/mage/cards/m/Mirari.java @@ -84,7 +84,7 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl { } MirariTriggeredAbility() { - super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyTargetSpellEffect(), new GenericManaCost(3)), false); + super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyTargetSpellEffect(true), new GenericManaCost(3)), false); this.addTarget(new TargetSpell(filter)); } diff --git a/Mage.Sets/src/mage/cards/o/OdricLunarchMarshal.java b/Mage.Sets/src/mage/cards/o/OdricLunarchMarshal.java index 353a072d4b1..a88797dcdc9 100644 --- a/Mage.Sets/src/mage/cards/o/OdricLunarchMarshal.java +++ b/Mage.Sets/src/mage/cards/o/OdricLunarchMarshal.java @@ -171,7 +171,7 @@ class OdricLunarchMarshalEffect extends OneShotEffect { // Skulk if (game.getBattlefield().contains(filterSkulk, source.getControllerId(), 1, game)) { - game.addEffect(new GainAbilityControlledEffect(SkulkAbility.getInstance(), Duration.EndOfTurn, filterCreatures), source); + game.addEffect(new GainAbilityControlledEffect(new SkulkAbility(), Duration.EndOfTurn, filterCreatures), source); } // Trample @@ -185,4 +185,4 @@ class OdricLunarchMarshalEffect extends OneShotEffect { } return true; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/p/PaleRiderOfTrostad.java b/Mage.Sets/src/mage/cards/p/PaleRiderOfTrostad.java index e270688f21d..f09cf4f27b8 100644 --- a/Mage.Sets/src/mage/cards/p/PaleRiderOfTrostad.java +++ b/Mage.Sets/src/mage/cards/p/PaleRiderOfTrostad.java @@ -50,7 +50,7 @@ public class PaleRiderOfTrostad extends CardImpl { this.toughness = new MageInt(3); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // When Pale Rider of Trostad enters the battlefield, discard a card. this.addAbility(new EntersBattlefieldTriggeredAbility(new DiscardControllerEffect(1), false)); diff --git a/Mage.Sets/src/mage/cards/p/PersistentNightmare.java b/Mage.Sets/src/mage/cards/p/PersistentNightmare.java index 59a76bd4ff4..efaf3951a0e 100644 --- a/Mage.Sets/src/mage/cards/p/PersistentNightmare.java +++ b/Mage.Sets/src/mage/cards/p/PersistentNightmare.java @@ -54,7 +54,7 @@ public class PersistentNightmare extends CardImpl { this.nightCard = true; // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // When Persistent Nightmare deals combat damage to a player, return it to its owner's hand. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new ReturnToHandSourceEffect(), false)); diff --git a/Mage.Sets/src/mage/cards/p/PrimalWellspring.java b/Mage.Sets/src/mage/cards/p/PrimalWellspring.java index cbdbae5b85c..fe6bcfba62b 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalWellspring.java +++ b/Mage.Sets/src/mage/cards/p/PrimalWellspring.java @@ -59,7 +59,7 @@ public class PrimalWellspring extends CardImpl { this.addAbility(ability); // When that mana is spent to cast an instant or sorcery spell, copy that spell and you may choose new targets for the copy. - Effect effect = new CopyTargetSpellEffect(); + Effect effect = new CopyTargetSpellEffect(true); effect.setText("copy that spell and you may choose new targets for the copy"); this.addAbility(new PyrimalWellspringTriggeredAbility(ability.getOriginalId(), effect)); } diff --git a/Mage.Sets/src/mage/cards/p/PyromancerAscension.java b/Mage.Sets/src/mage/cards/p/PyromancerAscension.java index 556835d0473..21a6ac5d85e 100644 --- a/Mage.Sets/src/mage/cards/p/PyromancerAscension.java +++ b/Mage.Sets/src/mage/cards/p/PyromancerAscension.java @@ -127,7 +127,7 @@ class PyromancerAscensionQuestTriggeredAbility extends TriggeredAbilityImpl { class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl { PyromancerAscensionCopyTriggeredAbility() { - super(Zone.BATTLEFIELD, new CopyTargetSpellEffect(), true); + super(Zone.BATTLEFIELD, new CopyTargetSpellEffect(true), true); } PyromancerAscensionCopyTriggeredAbility(final PyromancerAscensionCopyTriggeredAbility ability) { diff --git a/Mage.Sets/src/mage/cards/p/PyromancersGoggles.java b/Mage.Sets/src/mage/cards/p/PyromancersGoggles.java index fd658c276eb..bc8b0429891 100644 --- a/Mage.Sets/src/mage/cards/p/PyromancersGoggles.java +++ b/Mage.Sets/src/mage/cards/p/PyromancersGoggles.java @@ -62,7 +62,7 @@ public class PyromancersGoggles extends CardImpl { this.addAbility(ability); // When that mana is used to cast a red instant or sorcery spell, copy that spell and you may choose new targets for the copy. - Effect effect = new CopyTargetSpellEffect(); + Effect effect = new CopyTargetSpellEffect(true); effect.setText("copy that spell and you may choose new targets for the copy"); this.addAbility(new PyromancersGogglesTriggeredAbility(ability.getOriginalId(), effect)); diff --git a/Mage.Sets/src/mage/cards/r/RamosDragonEngine.java b/Mage.Sets/src/mage/cards/r/RamosDragonEngine.java index e6fc90f0e12..7453ae445f7 100644 --- a/Mage.Sets/src/mage/cards/r/RamosDragonEngine.java +++ b/Mage.Sets/src/mage/cards/r/RamosDragonEngine.java @@ -101,7 +101,7 @@ class RamosDragonEngineAddCountersEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (you != null && permanent != null) { - Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source)); + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); if (spell != null) { int amount = 0; if (spell.getColor(game).isWhite()) { diff --git a/Mage.Sets/src/mage/cards/r/RancidRats.java b/Mage.Sets/src/mage/cards/r/RancidRats.java index 630cf94c5ca..4dfdb9d0698 100644 --- a/Mage.Sets/src/mage/cards/r/RancidRats.java +++ b/Mage.Sets/src/mage/cards/r/RancidRats.java @@ -50,7 +50,7 @@ public class RancidRats extends CardImpl { this.toughness = new MageInt(1); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // Deathtouch this.addAbility(DeathtouchAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/cards/r/RebornHero.java b/Mage.Sets/src/mage/cards/r/RebornHero.java new file mode 100644 index 00000000000..36bbc8221fa --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RebornHero.java @@ -0,0 +1,91 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.r; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.CardsInControllerGraveCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.constants.SubType; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AbilityWord; +import mage.constants.CardType; +import mage.constants.Zone; + +/** + * + * @author TheElk801 + */ +public class RebornHero extends CardImpl { + + public RebornHero(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Threshold - As long as seven or more cards are in your graveyard, Reborn Hero has "When Reborn Hero dies, you may pay {W}{W}. If you do, return Reborn Hero to the battlefield under your control." + Ability ability = new SimpleStaticAbility( + Zone.BATTLEFIELD, + new ConditionalContinuousEffect( + new GainAbilitySourceEffect(new DiesTriggeredAbility(new DoIfCostPaid( + new ReturnSourceFromGraveyardToBattlefieldEffect(), new ManaCostsImpl("{W}{W}") + ))), + new CardsInControllerGraveCondition(7), + "As long as seven or more cards are in your graveyard, " + + "{this} has \"When {this} dies, you may pay {W}{W}. " + + "If you do, return {this} to the battlefield under your control.\"" + ) + ); + ability.setAbilityWord(AbilityWord.THRESHOLD); + this.addAbility(ability); + } + + public RebornHero(final RebornHero card) { + super(card); + } + + @Override + public RebornHero copy() { + return new RebornHero(this); + } +} diff --git a/Mage.Sets/src/mage/cards/r/ReveilleSquad.java b/Mage.Sets/src/mage/cards/r/ReveilleSquad.java new file mode 100644 index 00000000000..3c7aa5d44ce --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/ReveilleSquad.java @@ -0,0 +1,107 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.r; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.condition.InvertCondition; +import mage.abilities.condition.common.SourceTappedCondition; +import mage.abilities.effects.common.UntapAllControllerEffect; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author TheElk801 + */ +public class ReveilleSquad extends CardImpl { + + public ReveilleSquad(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.REBEL); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever one or more creatures attack you, if Reveille Squad is untapped, you may untap all creatures you control. + this.addAbility(new ReveilleSquadTriggeredAbility()); + } + + public ReveilleSquad(final ReveilleSquad card) { + super(card); + } + + @Override + public ReveilleSquad copy() { + return new ReveilleSquad(this); + } +} + +class ReveilleSquadTriggeredAbility extends TriggeredAbilityImpl { + + public ReveilleSquadTriggeredAbility() { + super(Zone.BATTLEFIELD, new UntapAllControllerEffect(new FilterCreaturePermanent("all creatures you control")), true); + } + + public ReveilleSquadTriggeredAbility(final ReveilleSquadTriggeredAbility ability) { + super(ability); + } + + @Override + public ReveilleSquadTriggeredAbility copy() { + return new ReveilleSquadTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return game.getCombat().getDefenders().contains(controllerId); + } + + @Override + public boolean checkInterveningIfClause(Game game) { + return new InvertCondition(SourceTappedCondition.instance).apply(game, this); + } + + @Override + public String getRule() { + return "Whenever one or more creatures attack you, if {this} is untapped, you may untap all creatures you control."; + } +} diff --git a/Mage.Sets/src/mage/cards/r/RikuOfTwoReflections.java b/Mage.Sets/src/mage/cards/r/RikuOfTwoReflections.java index b9c21392346..78b85688e7f 100644 --- a/Mage.Sets/src/mage/cards/r/RikuOfTwoReflections.java +++ b/Mage.Sets/src/mage/cards/r/RikuOfTwoReflections.java @@ -78,7 +78,7 @@ public class RikuOfTwoReflections extends CardImpl { this.toughness = new MageInt(2); // Whenever you cast an instant or sorcery spell, you may pay {U}{R}. If you do, copy that spell. You may choose new targets for the copy. - Effect effect = new CopyTargetSpellEffect(); + Effect effect = new CopyTargetSpellEffect(true); effect.setText("copy that spell. You may choose new targets for the copy"); this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(effect, new ManaCostsImpl("{U}{R}")), filter, false, true)); diff --git a/Mage.Sets/src/mage/cards/s/SearchForAzcanta.java b/Mage.Sets/src/mage/cards/s/SearchForAzcanta.java index 1fe5f694a8d..d4b7ea1ec25 100644 --- a/Mage.Sets/src/mage/cards/s/SearchForAzcanta.java +++ b/Mage.Sets/src/mage/cards/s/SearchForAzcanta.java @@ -31,8 +31,6 @@ import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.common.CardsInControllerGraveCondition; -import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.keyword.TransformAbility; @@ -64,9 +62,7 @@ public class SearchForAzcanta extends CardImpl { this.addSuperType(SuperType.LEGENDARY); // At the beginning of your upkeep, look at the top card of your library. You may put it into your graveyard. Then if you have seven or more cards in your graveyard, you may transform Search for Azcanta. - Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SearchForAzcantaLookLibraryEffect(), TargetController.YOU, true); - ability.addEffect(new ConditionalOneShotEffect(new TransformSourceEffect(true), new CardsInControllerGraveCondition(7), - "Then if you have seven or more cards in your graveyard, you may transform {this}")); + Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SearchForAzcantaLookLibraryEffect(), TargetController.YOU, false); this.addAbility(ability); this.addAbility(new TransformAbility()); } @@ -85,7 +81,8 @@ class SearchForAzcantaLookLibraryEffect extends OneShotEffect { public SearchForAzcantaLookLibraryEffect() { super(Outcome.DrawCard); - this.staticText = "look at the top card of your library. You may put that card into your graveyard"; + this.staticText = "look at the top card of your library. You may put that card into your graveyard. " + + "Then if you have seven or more cards in your graveyard, you may transform {this}."; } public SearchForAzcantaLookLibraryEffect(final SearchForAzcantaLookLibraryEffect effect) { @@ -109,9 +106,11 @@ class SearchForAzcantaLookLibraryEffect extends OneShotEffect { cards.add(card); controller.lookAtCards(sourceObject.getIdName(), cards, game); if (controller.chooseUse(Outcome.Neutral, "Do you wish to put the card into your graveyard?", source, game)) { - return controller.moveCards(card, Zone.GRAVEYARD, source, game); + controller.moveCards(card, Zone.GRAVEYARD, source, game); + } + if (controller.getGraveyard().size() > 6 && controller.chooseUse(Outcome.Neutral, "Transform " + sourceObject.getLogName() + "?", source, game)) { + new TransformSourceEffect(true).apply(game, source); } - } } return true; diff --git a/Mage.Sets/src/mage/cards/s/SkeletonKey.java b/Mage.Sets/src/mage/cards/s/SkeletonKey.java index dc3774257df..72dc2d91d3b 100644 --- a/Mage.Sets/src/mage/cards/s/SkeletonKey.java +++ b/Mage.Sets/src/mage/cards/s/SkeletonKey.java @@ -57,7 +57,7 @@ public class SkeletonKey extends CardImpl { this.subtype.add(SubType.EQUIPMENT); // Equipped creature has skulk. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(SkulkAbility.getInstance(), AttachmentType.EQUIPMENT))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new SkulkAbility(), AttachmentType.EQUIPMENT))); // Whenever equipped creature deals combat damage to a player, you may draw a card. if you do, discard a card. Ability ability = new DealsDamageToAPlayerAttachedTriggeredAbility(new DrawCardSourceControllerEffect(1), "equipped creature", true); diff --git a/Mage.Sets/src/mage/cards/s/SoulConduit.java b/Mage.Sets/src/mage/cards/s/SoulConduit.java index 0c0f79edf54..9fbf7f21ff2 100644 --- a/Mage.Sets/src/mage/cards/s/SoulConduit.java +++ b/Mage.Sets/src/mage/cards/s/SoulConduit.java @@ -54,8 +54,7 @@ public class SoulConduit extends CardImpl { // {6}, {tap}: Two target players exchange life totals. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SoulConduitEffect(), new GenericManaCost(6)); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetPlayer()); - ability.addTarget(new TargetPlayer()); + ability.addTarget(new TargetPlayer(2)); this.addAbility(ability); } @@ -87,8 +86,8 @@ class SoulConduitEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player1 = game.getPlayer(source.getFirstTarget()); - Player player2 = game.getPlayer(source.getTargets().get(1).getFirstTarget()); + Player player1 = game.getPlayer(source.getTargets().get(0).getTargets().get(0)); + Player player2 = game.getPlayer(source.getTargets().get(0).getTargets().get(1)); if (player1 != null && player2 != null) { int lifePlayer1 = player1.getLife(); int lifePlayer2 = player2.getLife(); diff --git a/Mage.Sets/src/mage/cards/s/StalkingYeti.java b/Mage.Sets/src/mage/cards/s/StalkingYeti.java new file mode 100644 index 00000000000..edb00ec5c5e --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StalkingYeti.java @@ -0,0 +1,118 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.s; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.SourceOnBattlefieldCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnToHandSourceEffect; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetOpponentsCreaturePermanent; + +/** + * + * @author TheElk801 + */ +public class StalkingYeti extends CardImpl { + + public StalkingYeti(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); + + this.addSuperType(SuperType.SNOW); + this.subtype.add(SubType.YETI); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Stalking Yeti enters the battlefield, if it's on the battlefield, it deals damage equal to its power to target creature an opponent controls and that creature deals damage equal to its power to Stalking Yeti. + Ability ability = new ConditionalTriggeredAbility( + new EntersBattlefieldTriggeredAbility(new StalkingYetiEffect()), + SourceOnBattlefieldCondition.instance, + "When {this} enters the battlefield, if it's on the battlefield, " + + "it deals damage equal to its power to target creature an opponent controls " + + "and that creature deals damage equal to its power to {this}." + ); + ability.addTarget(new TargetOpponentsCreaturePermanent()); + this.addAbility(ability); + + // {2}{snow}: Return Stalking Yeti to its owner's hand. Activate this ability only any time you could cast a sorcery. + this.addAbility(new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ManaCostsImpl("{2}{S}"))); + } + + public StalkingYeti(final StalkingYeti card) { + super(card); + } + + @Override + public StalkingYeti copy() { + return new StalkingYeti(this); + } +} + +class StalkingYetiEffect extends OneShotEffect { + + StalkingYetiEffect() { + super(Outcome.Benefit); + this.staticText = "it deals damage equal to its power to target creature an opponent controls " + + "and that creature deals damage equal to its power to {this}"; + } + + StalkingYetiEffect(final StalkingYetiEffect effect) { + super(effect); + } + + @Override + public StalkingYetiEffect copy() { + return new StalkingYetiEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent thisCreature = game.getPermanent(source.getSourceId()); + Permanent thatCreature = game.getPermanent(source.getFirstTarget()); + if (thisCreature == null || thatCreature == null) { + return false; + } + thatCreature.damage(thisCreature.getPower().getValue(), thisCreature.getId(), game, false, true); + thisCreature.damage(thatCreature.getPower().getValue(), thatCreature.getId(), game, false, true); + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/s/StrongarmTactics.java b/Mage.Sets/src/mage/cards/s/StrongarmTactics.java new file mode 100644 index 00000000000..8cf580d96a1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StrongarmTactics.java @@ -0,0 +1,124 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.s; + +import java.util.HashMap; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetDiscard; + +/** + * + * @author TheElk801 + */ +public class StrongarmTactics extends CardImpl { + + public StrongarmTactics(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}"); + + // Each player discards a card. Then each player who didn't discard a creature card this way loses 4 life. + this.getSpellAbility().addEffect(new StrongarmTacticsEffect()); + } + + public StrongarmTactics(final StrongarmTactics card) { + super(card); + } + + @Override + public StrongarmTactics copy() { + return new StrongarmTactics(this); + } +} + +class StrongarmTacticsEffect extends OneShotEffect { + + StrongarmTacticsEffect() { + super(Outcome.Discard); + this.staticText = "Each player discards a card. Then each player who didn't discard a creature card this way loses 4 life."; + } + + StrongarmTacticsEffect(final StrongarmTacticsEffect effect) { + super(effect); + } + + @Override + public StrongarmTacticsEffect copy() { + return new StrongarmTacticsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + // Store for each player the cards to discard, that's important because all discard shall happen at the same time + HashMap cardsToDiscard = new HashMap<>(); + if (controller != null) { + // choose cards to discard + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + int numberOfCardsToDiscard = Math.min(1, player.getHand().size()); + Cards cards = new CardsImpl(); + Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, new FilterCard(), playerId); + player.chooseTarget(outcome, target, source, game); + cards.addAll(target.getTargets()); + cardsToDiscard.put(playerId, cards); + } + } + // discard all choosen cards + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + Cards cardsPlayer = cardsToDiscard.get(playerId); + if (cardsPlayer != null) { + for (UUID cardId : cardsPlayer) { + Card card = game.getCard(cardId); + if (card != null) { + if (!(player.discard(card, source, game) && card.isCreature())) { + player.loseLife(4, game, false); + } + } + } + } + } + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/s/SunbirdsInvocation.java b/Mage.Sets/src/mage/cards/s/SunbirdsInvocation.java index e451faaa090..0b934660f81 100644 --- a/Mage.Sets/src/mage/cards/s/SunbirdsInvocation.java +++ b/Mage.Sets/src/mage/cards/s/SunbirdsInvocation.java @@ -92,7 +92,7 @@ class SunbirdsInvocationTriggeredAbility extends SpellCastControllerTriggeredAbi if (spell != null && spell.getFromZone() == Zone.HAND) { if (spell.getCard() != null) { for (Effect effect : getEffects()) { - effect.setTargetPointer(new FixedTarget(spell.getId(), spell.getZoneChangeCounter(game))); + effect.setTargetPointer(new FixedTarget(spell.getId())); } return true; } @@ -125,8 +125,12 @@ class SunbirdsInvocationEffect extends OneShotEffect { if (controller == null || sourceObject == null) { return false; } + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); + if (spell == null) { + return false; + } + int xValue = spell.getConvertedManaCost(); Cards cards = new CardsImpl(); - int xValue = game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.STACK).getConvertedManaCost(); cards.addAll(controller.getLibrary().getTopCards(game, xValue)); if (!cards.isEmpty()) { controller.revealCards(sourceObject.getIdName(), cards, game); @@ -138,7 +142,7 @@ class SunbirdsInvocationEffect extends OneShotEffect { if (controller.chooseTarget(Outcome.PlayForFree, cards, target, source, game)) { Card card = cards.get(target.getFirstTarget(), game); if (card != null) { - if (controller.chooseUse(outcome, "Do you wish to cast " + card.getName(), source, game)) { + if (controller.chooseUse(outcome, "Cast " + card.getLogName() + " without paying its mana cost?", source, game)) { controller.cast(card.getSpellAbility(), game, true); cards.remove(card); } diff --git a/Mage.Sets/src/mage/cards/s/SwarmIntelligence.java b/Mage.Sets/src/mage/cards/s/SwarmIntelligence.java index b6418efb89e..4c1c1064b62 100644 --- a/Mage.Sets/src/mage/cards/s/SwarmIntelligence.java +++ b/Mage.Sets/src/mage/cards/s/SwarmIntelligence.java @@ -46,7 +46,7 @@ public class SwarmIntelligence extends CardImpl { // Whenever you cast an instant or sorcery spell, you may copy that spell. You may choose new targets for the copy. this.addAbility(new SpellCastControllerTriggeredAbility( - new CopyTargetSpellEffect().setText("you may copy that spell. You may choose new targets for the copy"), new FilterInstantOrSorcerySpell("an instant or sorcery spell"), true, true)); + new CopyTargetSpellEffect(true).setText("you may copy that spell. You may choose new targets for the copy"), new FilterInstantOrSorcerySpell("an instant or sorcery spell"), true, true)); } public SwarmIntelligence(final SwarmIntelligence card) { diff --git a/Mage.Sets/src/mage/cards/t/TeferisVeil.java b/Mage.Sets/src/mage/cards/t/TeferisVeil.java new file mode 100644 index 00000000000..58ff55d718a --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TeferisVeil.java @@ -0,0 +1,63 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.t; + +import java.util.UUID; +import mage.abilities.common.AttacksCreatureYouControlTriggeredAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.PhaseOutTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; + +/** + * + * @author TheElk801 + */ +public class TeferisVeil extends CardImpl { + + public TeferisVeil(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); + + // Whenever a creature you control attacks, it phases out at end of combat. + Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new PhaseOutTargetEffect("it", false))); + effect.setText("it phases out at end of combat"); + this.addAbility(new AttacksCreatureYouControlTriggeredAbility(effect, false, true)); + } + + public TeferisVeil(final TeferisVeil card) { + super(card); + } + + @Override + public TeferisVeil copy() { + return new TeferisVeil(this); + } +} diff --git a/Mage.Sets/src/mage/cards/t/TunnelVision.java b/Mage.Sets/src/mage/cards/t/TunnelVision.java index 03ef8cd3b83..9c1b33d6984 100644 --- a/Mage.Sets/src/mage/cards/t/TunnelVision.java +++ b/Mage.Sets/src/mage/cards/t/TunnelVision.java @@ -27,6 +27,8 @@ */ package mage.cards.t; +import java.util.HashSet; +import java.util.Set; import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; @@ -51,10 +53,10 @@ import mage.target.TargetPlayer; public class TunnelVision extends CardImpl { public TunnelVision(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{5}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{U}"); - // Name a card. Target player reveals cards from the top of his or her library until the named card is revealed. - // If it is, that player puts the rest of the revealed cards into his or her graveyard and puts the named card on top of his or her library. + // Name a card. Target player reveals cards from the top of his or her library until the named card is revealed. + // If it is, that player puts the rest of the revealed cards into his or her graveyard and puts the named card on top of his or her library. // Otherwise, the player shuffles his or her library. this.getSpellAbility().addEffect(new NameACardEffect(NameACardEffect.TypeOfName.ALL)); this.getSpellAbility().addEffect(new TunnelVisionEffect()); @@ -74,7 +76,7 @@ public class TunnelVision extends CardImpl { class TunnelVisionEffect extends OneShotEffect { public TunnelVisionEffect() { - super(Outcome.Damage); + super(Outcome.Benefit); this.staticText = "Target player reveals cards from the top of his or her library until the named card is revealed. If it is, that player puts the rest of the revealed cards into his or her graveyard and puts the named card on top of his or her library. Otherwise, the player shuffles his or her library."; } @@ -90,16 +92,16 @@ class TunnelVisionEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { MageObject sourceObject = game.getObject(source.getSourceId()); - Player targetPlayer = game.getPlayer(source.getFirstTarget()); + Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); if (sourceObject == null || targetPlayer == null || cardName == null || cardName.isEmpty()) { return false; } Cards cardsToReveal = new CardsImpl(); - Cards cardsToBury = new CardsImpl(); + Set cardsToBury = new HashSet<>(); Card namedCard = null; - + // reveal until named card found // if named card found, put all revealed cards in grave and put named card on top of library // if named card not found, shuffle library @@ -117,15 +119,15 @@ class TunnelVisionEffect extends OneShotEffect { } } } - + targetPlayer.revealCards(sourceObject.getIdName(), cardsToReveal, game); if (namedCardFound) { targetPlayer.moveCards(cardsToBury, Zone.GRAVEYARD, source, game); targetPlayer.moveCards(namedCard, Zone.LIBRARY, source, game); } else { + targetPlayer.getLibrary().addAll(cardsToBury, game); targetPlayer.shuffleLibrary(source, game); } - return true; } } diff --git a/Mage.Sets/src/mage/cards/u/UninvitedGeist.java b/Mage.Sets/src/mage/cards/u/UninvitedGeist.java index 037328203e1..4dd1c9776e1 100644 --- a/Mage.Sets/src/mage/cards/u/UninvitedGeist.java +++ b/Mage.Sets/src/mage/cards/u/UninvitedGeist.java @@ -54,7 +54,7 @@ public class UninvitedGeist extends CardImpl { this.secondSideCardClazz = UnimpededTrespasser.class; // Skulk (This creature can't be blocked by creatures with greater power.) - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // When Uninvited Geist deals combat damage to a player, transform it. this.addAbility(new TransformAbility()); diff --git a/Mage.Sets/src/mage/cards/v/VampireCutthroat.java b/Mage.Sets/src/mage/cards/v/VampireCutthroat.java index b57163f93c7..a83227695c8 100644 --- a/Mage.Sets/src/mage/cards/v/VampireCutthroat.java +++ b/Mage.Sets/src/mage/cards/v/VampireCutthroat.java @@ -50,7 +50,7 @@ public class VampireCutthroat extends CardImpl { this.toughness = new MageInt(1); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // Lifelink this.addAbility(LifelinkAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/cards/w/WeaverOfLies.java b/Mage.Sets/src/mage/cards/w/WeaverOfLies.java new file mode 100644 index 00000000000..f43b4290401 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WeaverOfLies.java @@ -0,0 +1,121 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.w; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility; +import mage.constants.SubType; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect; +import mage.abilities.keyword.MorphAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.PermanentIdPredicate; +import mage.game.Game; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author TheElk801 + */ +public class WeaverOfLies extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("other creatures with a morph ability"); + + static { + filter.add(new AbilityPredicate(MorphAbility.class)); + filter.add(new AnotherPredicate()); + } + + public WeaverOfLies(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}"); + + this.subtype.add(SubType.BEAST); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Morph {4}{U} + this.addAbility(new MorphAbility(this, new ManaCostsImpl("{4}{U}"))); + + // When Weaver of Lies is turned face up, turn any number of target creatures with a morph ability other than Weaver of Lies face down. + Ability ability = new TurnedFaceUpSourceTriggeredAbility(new WeaverOfLiesEffect(), false, false); + ability.addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, false)); + this.addAbility(ability); + } + + public WeaverOfLies(final WeaverOfLies card) { + super(card); + } + + @Override + public WeaverOfLies copy() { + return new WeaverOfLies(this); + } +} + +class WeaverOfLiesEffect extends OneShotEffect { + + WeaverOfLiesEffect() { + super(Outcome.Benefit); + this.staticText = "turn any number of target creatures with a morph ability other than {this} face down"; + } + + WeaverOfLiesEffect(final WeaverOfLiesEffect effect) { + super(effect); + } + + @Override + public WeaverOfLiesEffect copy() { + return new WeaverOfLiesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Predicate pred = new PermanentIdPredicate(UUID.randomUUID()); + for (Target target : source.getTargets()) { + for (UUID targetId : target.getTargets()) { + pred = Predicates.or(pred, new PermanentIdPredicate(targetId)); + } + } + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(pred); + game.addEffect(new BecomesFaceDownCreatureAllEffect(filter), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java b/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java index 9c49a67b5df..9e3116fc858 100644 --- a/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java +++ b/Mage.Sets/src/mage/cards/w/WharfInfiltrator.java @@ -62,7 +62,7 @@ public class WharfInfiltrator extends CardImpl { this.toughness = new MageInt(1); // Skulk - this.addAbility(SkulkAbility.getInstance()); + this.addAbility(new SkulkAbility()); // Whenever Wharf Infiltrator deals combat damage to a player, you may draw a card. If you do, discard a card. Effect effect = new DrawDiscardControllerEffect(); diff --git a/Mage.Sets/src/mage/cards/z/ZadaHedronGrinder.java b/Mage.Sets/src/mage/cards/z/ZadaHedronGrinder.java index 90ffe363c1a..d4498f3f01b 100644 --- a/Mage.Sets/src/mage/cards/z/ZadaHedronGrinder.java +++ b/Mage.Sets/src/mage/cards/z/ZadaHedronGrinder.java @@ -154,10 +154,7 @@ class ZadaHedronGrinderEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); - if (spell == null) { - spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK); - } + Spell spell = game.getSpellOrLKIStack(this.getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (spell != null && controller != null) { // search the target that targets source diff --git a/Mage.Sets/src/mage/sets/Coldsnap.java b/Mage.Sets/src/mage/sets/Coldsnap.java index ee0b109eb13..763d832d9dd 100644 --- a/Mage.Sets/src/mage/sets/Coldsnap.java +++ b/Mage.Sets/src/mage/sets/Coldsnap.java @@ -158,6 +158,7 @@ public class Coldsnap extends ExpansionSet { cards.add(new SetCardInfo("Snow-Covered Swamp", 153, Rarity.COMMON, mage.cards.s.SnowCoveredSwamp.class)); cards.add(new SetCardInfo("Soul Spike", 70, Rarity.RARE, mage.cards.s.SoulSpike.class)); cards.add(new SetCardInfo("Squall Drifter", 17, Rarity.COMMON, mage.cards.s.SquallDrifter.class)); + cards.add(new SetCardInfo("Stalking Yeti", 98, Rarity.UNCOMMON, mage.cards.s.StalkingYeti.class)); cards.add(new SetCardInfo("Steam Spitter", 124, Rarity.UNCOMMON, mage.cards.s.SteamSpitter.class)); cards.add(new SetCardInfo("Stromgald Crusader", 71, Rarity.UNCOMMON, mage.cards.s.StromgaldCrusader.class)); cards.add(new SetCardInfo("Sun's Bounty", 18, Rarity.COMMON, mage.cards.s.SunsBounty.class)); diff --git a/Mage.Sets/src/mage/sets/Darksteel.java b/Mage.Sets/src/mage/sets/Darksteel.java index d26fe1ecd7d..9957d16d781 100644 --- a/Mage.Sets/src/mage/sets/Darksteel.java +++ b/Mage.Sets/src/mage/sets/Darksteel.java @@ -78,6 +78,7 @@ public class Darksteel extends ExpansionSet { cards.add(new SetCardInfo("Fireball", 60, Rarity.UNCOMMON, mage.cards.f.Fireball.class)); cards.add(new SetCardInfo("Flamebreak", 61, Rarity.RARE, mage.cards.f.Flamebreak.class)); cards.add(new SetCardInfo("Furnace Dragon", 62, Rarity.RARE, mage.cards.f.FurnaceDragon.class)); + cards.add(new SetCardInfo("Gemini Engine", 121, Rarity.RARE, mage.cards.g.GeminiEngine.class)); cards.add(new SetCardInfo("Genesis Chamber", 122, Rarity.UNCOMMON, mage.cards.g.GenesisChamber.class)); cards.add(new SetCardInfo("Geth's Grimoire", 123, Rarity.UNCOMMON, mage.cards.g.GethsGrimoire.class)); cards.add(new SetCardInfo("Goblin Archaeologist", 63, Rarity.UNCOMMON, mage.cards.g.GoblinArchaeologist.class)); diff --git a/Mage.Sets/src/mage/sets/Legions.java b/Mage.Sets/src/mage/sets/Legions.java index fe75ca609d6..07fb01d4605 100644 --- a/Mage.Sets/src/mage/sets/Legions.java +++ b/Mage.Sets/src/mage/sets/Legions.java @@ -133,6 +133,7 @@ public class Legions extends ExpansionSet { cards.add(new SetCardInfo("Lowland Tracker", 17, Rarity.COMMON, mage.cards.l.LowlandTracker.class)); cards.add(new SetCardInfo("Macetail Hystrodon", 106, Rarity.COMMON, mage.cards.m.MacetailHystrodon.class)); cards.add(new SetCardInfo("Magma Sliver", 107, Rarity.RARE, mage.cards.m.MagmaSliver.class)); + cards.add(new SetCardInfo("Master of the Veil", 43, Rarity.UNCOMMON, mage.cards.m.MasterOfTheVeil.class)); cards.add(new SetCardInfo("Merchant of Secrets", 44, Rarity.COMMON, mage.cards.m.MerchantOfSecrets.class)); cards.add(new SetCardInfo("Mistform Sliver", 46, Rarity.COMMON, mage.cards.m.MistformSliver.class)); cards.add(new SetCardInfo("Mistform Ultimus", 47, Rarity.RARE, mage.cards.m.MistformUltimus.class)); @@ -178,6 +179,7 @@ public class Legions extends ExpansionSet { cards.add(new SetCardInfo("Wall of Hope", 24, Rarity.COMMON, mage.cards.w.WallOfHope.class)); cards.add(new SetCardInfo("Warbreak Trumpeter", 116, Rarity.UNCOMMON, mage.cards.w.WarbreakTrumpeter.class)); cards.add(new SetCardInfo("Ward Sliver", 25, Rarity.UNCOMMON, mage.cards.w.WardSliver.class)); + cards.add(new SetCardInfo("Weaver of Lies", 57, Rarity.RARE, mage.cards.w.WeaverOfLies.class)); cards.add(new SetCardInfo("White Knight", 27, Rarity.UNCOMMON, mage.cards.w.WhiteKnight.class)); cards.add(new SetCardInfo("Willbender", 58, Rarity.UNCOMMON, mage.cards.w.Willbender.class)); cards.add(new SetCardInfo("Windborn Muse", 28, Rarity.RARE, mage.cards.w.WindbornMuse.class)); diff --git a/Mage.Sets/src/mage/sets/MercadianMasques.java b/Mage.Sets/src/mage/sets/MercadianMasques.java index 8fb42c57ac8..3e9b6c05881 100644 --- a/Mage.Sets/src/mage/sets/MercadianMasques.java +++ b/Mage.Sets/src/mage/sets/MercadianMasques.java @@ -67,6 +67,7 @@ public class MercadianMasques extends ExpansionSet { cards.add(new SetCardInfo("Blaster Mage", 175, Rarity.COMMON, mage.cards.b.BlasterMage.class)); cards.add(new SetCardInfo("Blockade Runner", 60, Rarity.COMMON, mage.cards.b.BlockadeRunner.class)); cards.add(new SetCardInfo("Blood Hound", 176, Rarity.RARE, mage.cards.b.BloodHound.class)); + cards.add(new SetCardInfo("Blood Oath", 177, Rarity.RARE, mage.cards.b.BloodOath.class)); cards.add(new SetCardInfo("Boa Constrictor", 231, Rarity.UNCOMMON, mage.cards.b.BoaConstrictor.class)); cards.add(new SetCardInfo("Bog Smugglers", 117, Rarity.COMMON, mage.cards.b.BogSmugglers.class)); cards.add(new SetCardInfo("Bog Witch", 118, Rarity.COMMON, mage.cards.b.BogWitch.class)); @@ -151,6 +152,7 @@ public class MercadianMasques extends ExpansionSet { cards.add(new SetCardInfo("Fountain Watch", 19, Rarity.RARE, mage.cards.f.FountainWatch.class)); cards.add(new SetCardInfo("Fresh Volunteers", 20, Rarity.COMMON, mage.cards.f.FreshVolunteers.class)); cards.add(new SetCardInfo("Furious Assault", 191, Rarity.COMMON, mage.cards.f.FuriousAssault.class)); + cards.add(new SetCardInfo("Game Preserve", 248, Rarity.RARE, mage.cards.g.GamePreserve.class)); cards.add(new SetCardInfo("Gerrard's Irregulars", 192, Rarity.COMMON, mage.cards.g.GerrardsIrregulars.class)); cards.add(new SetCardInfo("Ghoul's Feast", 137, Rarity.UNCOMMON, mage.cards.g.GhoulsFeast.class)); cards.add(new SetCardInfo("Giant Caterpillar", 249, Rarity.COMMON, mage.cards.g.GiantCaterpillar.class)); diff --git a/Mage.Sets/src/mage/sets/Mirrodin.java b/Mage.Sets/src/mage/sets/Mirrodin.java index 3a7768c5232..7a658929219 100644 --- a/Mage.Sets/src/mage/sets/Mirrodin.java +++ b/Mage.Sets/src/mage/sets/Mirrodin.java @@ -160,6 +160,7 @@ public class Mirrodin extends ExpansionSet { cards.add(new SetCardInfo("Mesmeric Orb", 204, Rarity.RARE, mage.cards.m.MesmericOrb.class)); cards.add(new SetCardInfo("Mind's Eye", 205, Rarity.RARE, mage.cards.m.MindsEye.class)); cards.add(new SetCardInfo("Mindslaver", 206, Rarity.RARE, mage.cards.m.Mindslaver.class)); + cards.add(new SetCardInfo("Mindstorm Crown", 207, Rarity.UNCOMMON, mage.cards.m.MindstormCrown.class)); cards.add(new SetCardInfo("Molder Slug", 125, Rarity.RARE, mage.cards.m.MolderSlug.class)); cards.add(new SetCardInfo("Molten Rain", 101, Rarity.COMMON, mage.cards.m.MoltenRain.class)); cards.add(new SetCardInfo("Moriok Scavenger", 68, Rarity.COMMON, mage.cards.m.MoriokScavenger.class)); diff --git a/Mage.Sets/src/mage/sets/Odyssey.java b/Mage.Sets/src/mage/sets/Odyssey.java index e5a06110704..70f7add0bab 100644 --- a/Mage.Sets/src/mage/sets/Odyssey.java +++ b/Mage.Sets/src/mage/sets/Odyssey.java @@ -120,6 +120,7 @@ public class Odyssey extends ExpansionSet { cards.add(new SetCardInfo("Crashing Centaur", 235, Rarity.UNCOMMON, mage.cards.c.CrashingCentaur.class)); cards.add(new SetCardInfo("Crypt Creeper", 125, Rarity.COMMON, mage.cards.c.CryptCreeper.class)); cards.add(new SetCardInfo("Crystal Quarry", 318, Rarity.RARE, mage.cards.c.CrystalQuarry.class)); + cards.add(new SetCardInfo("Cultural Exchange", 79, Rarity.RARE, mage.cards.c.CulturalExchange.class)); cards.add(new SetCardInfo("Cursed Monstrosity", 126, Rarity.RARE, mage.cards.c.CursedMonstrosity.class)); cards.add(new SetCardInfo("Darkwater Catacombs", 319, Rarity.RARE, mage.cards.d.DarkwaterCatacombs.class)); cards.add(new SetCardInfo("Darkwater Egg", 299, Rarity.UNCOMMON, mage.cards.d.DarkwaterEgg.class)); @@ -214,6 +215,7 @@ public class Odyssey extends ExpansionSet { cards.add(new SetCardInfo("Metamorphic Wurm", 250, Rarity.UNCOMMON, mage.cards.m.MetamorphicWurm.class)); cards.add(new SetCardInfo("Millikin", 302, Rarity.UNCOMMON, mage.cards.m.Millikin.class)); cards.add(new SetCardInfo("Mindslicer", 149, Rarity.RARE, mage.cards.m.Mindslicer.class)); + cards.add(new SetCardInfo("Mine Layer", 205, Rarity.RARE, mage.cards.m.MineLayer.class)); cards.add(new SetCardInfo("Minotaur Explorer", 206, Rarity.UNCOMMON, mage.cards.m.MinotaurExplorer.class)); cards.add(new SetCardInfo("Mirari", 303, Rarity.RARE, mage.cards.m.Mirari.class)); cards.add(new SetCardInfo("Molten Influence", 207, Rarity.RARE, mage.cards.m.MoltenInfluence.class)); diff --git a/Mage.Sets/src/mage/sets/Onslaught.java b/Mage.Sets/src/mage/sets/Onslaught.java index 493fbb2b48b..0a94569ee29 100644 --- a/Mage.Sets/src/mage/sets/Onslaught.java +++ b/Mage.Sets/src/mage/sets/Onslaught.java @@ -46,6 +46,7 @@ public class Onslaught extends ExpansionSet { cards.add(new SetCardInfo("Aven Brigadier", 7, Rarity.RARE, mage.cards.a.AvenBrigadier.class)); cards.add(new SetCardInfo("Aven Fateshaper", 69, Rarity.UNCOMMON, mage.cards.a.AvenFateshaper.class)); cards.add(new SetCardInfo("Aven Soulgazer", 8, Rarity.UNCOMMON, mage.cards.a.AvenSoulgazer.class)); + cards.add(new SetCardInfo("Backslide", 70, Rarity.COMMON, mage.cards.b.Backslide.class)); cards.add(new SetCardInfo("Barkhide Mauler", 246, Rarity.COMMON, mage.cards.b.BarkhideMauler.class)); cards.add(new SetCardInfo("Barren Moor", 312, Rarity.COMMON, mage.cards.b.BarrenMoor.class)); cards.add(new SetCardInfo("Battering Craghorn", 188, Rarity.COMMON, mage.cards.b.BatteringCraghorn.class)); @@ -276,6 +277,7 @@ public class Onslaught extends ExpansionSet { cards.add(new SetCardInfo("Starlit Sanctum", 325, Rarity.UNCOMMON, mage.cards.s.StarlitSanctum.class)); cards.add(new SetCardInfo("Starstorm", 238, Rarity.RARE, mage.cards.s.Starstorm.class)); cards.add(new SetCardInfo("Steely Resolve", 286, Rarity.RARE, mage.cards.s.SteelyResolve.class)); + cards.add(new SetCardInfo("Strongarm Tactics", 173, Rarity.RARE, mage.cards.s.StrongarmTactics.class)); cards.add(new SetCardInfo("Sunfire Balm", 56, Rarity.UNCOMMON, mage.cards.s.SunfireBalm.class)); cards.add(new SetCardInfo("Supreme Inquisitor", 117, Rarity.RARE, mage.cards.s.SupremeInquisitor.class)); cards.add(new SetCardInfo("Swamp", 339, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage.Sets/src/mage/sets/Prophecy.java b/Mage.Sets/src/mage/sets/Prophecy.java index b238baeb123..d9043b28adf 100644 --- a/Mage.Sets/src/mage/sets/Prophecy.java +++ b/Mage.Sets/src/mage/sets/Prophecy.java @@ -123,6 +123,7 @@ public class Prophecy extends ExpansionSet { cards.add(new SetCardInfo("Quicksilver Wall", 41, Rarity.UNCOMMON, mage.cards.q.QuicksilverWall.class)); cards.add(new SetCardInfo("Rebel Informer", 75, Rarity.RARE, mage.cards.r.RebelInformer.class)); cards.add(new SetCardInfo("Rethink", 42, Rarity.COMMON, mage.cards.r.Rethink.class)); + cards.add(new SetCardInfo("Reveille Squad", 18, Rarity.UNCOMMON, mage.cards.r.ReveilleSquad.class)); cards.add(new SetCardInfo("Rhystic Circle", 19, Rarity.COMMON, mage.cards.r.RhysticCircle.class)); cards.add(new SetCardInfo("Rhystic Study", 45, Rarity.COMMON, mage.cards.r.RhysticStudy.class)); cards.add(new SetCardInfo("Rhystic Tutor", 77, Rarity.RARE, mage.cards.r.RhysticTutor.class)); diff --git a/Mage.Sets/src/mage/sets/Torment.java b/Mage.Sets/src/mage/sets/Torment.java index 3a579e84d10..7ece361cda9 100644 --- a/Mage.Sets/src/mage/sets/Torment.java +++ b/Mage.Sets/src/mage/sets/Torment.java @@ -151,6 +151,7 @@ public class Torment extends ExpansionSet { cards.add(new SetCardInfo("Pyromania", 112, Rarity.UNCOMMON, mage.cards.p.Pyromania.class)); cards.add(new SetCardInfo("Radiate", 113, Rarity.RARE, mage.cards.r.Radiate.class)); cards.add(new SetCardInfo("Rancid Earth", 78, Rarity.COMMON, mage.cards.r.RancidEarth.class)); + cards.add(new SetCardInfo("Reborn Hero", 14, Rarity.RARE, mage.cards.r.RebornHero.class)); cards.add(new SetCardInfo("Restless Dreams", 79, Rarity.COMMON, mage.cards.r.RestlessDreams.class)); cards.add(new SetCardInfo("Sengir Vampire", 80, Rarity.RARE, mage.cards.s.SengirVampire.class)); cards.add(new SetCardInfo("Seton's Scout", 138, Rarity.UNCOMMON, mage.cards.s.SetonsScout.class)); diff --git a/Mage.Sets/src/mage/sets/UrzasSaga.java b/Mage.Sets/src/mage/sets/UrzasSaga.java index 6351e0fbe40..5f2187a3c7f 100644 --- a/Mage.Sets/src/mage/sets/UrzasSaga.java +++ b/Mage.Sets/src/mage/sets/UrzasSaga.java @@ -150,6 +150,7 @@ public class UrzasSaga extends ExpansionSet { cards.add(new SetCardInfo("Fertile Ground", 252, Rarity.COMMON, mage.cards.f.FertileGround.class)); cards.add(new SetCardInfo("Fiery Mantle", 186, Rarity.COMMON, mage.cards.f.FieryMantle.class)); cards.add(new SetCardInfo("Fire Ants", 187, Rarity.UNCOMMON, mage.cards.f.FireAnts.class)); + cards.add(new SetCardInfo("Flesh Reaver", 136, Rarity.UNCOMMON, mage.cards.f.FleshReaver.class)); cards.add(new SetCardInfo("Fluctuator", 295, Rarity.RARE, mage.cards.f.Fluctuator.class)); cards.add(new SetCardInfo("Fog Bank", 75, Rarity.UNCOMMON, mage.cards.f.FogBank.class)); cards.add(new SetCardInfo("Forest", 347, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage.Sets/src/mage/sets/Weatherlight.java b/Mage.Sets/src/mage/sets/Weatherlight.java index b3a5344f6a6..a27842ad076 100644 --- a/Mage.Sets/src/mage/sets/Weatherlight.java +++ b/Mage.Sets/src/mage/sets/Weatherlight.java @@ -178,6 +178,7 @@ public class Weatherlight extends ExpansionSet { cards.add(new SetCardInfo("Straw Golem", 158, Rarity.UNCOMMON, mage.cards.s.StrawGolem.class)); cards.add(new SetCardInfo("Striped Bears", 82, Rarity.COMMON, mage.cards.s.StripedBears.class)); cards.add(new SetCardInfo("Tariff", 144, Rarity.RARE, mage.cards.t.Tariff.class)); + cards.add(new SetCardInfo("Teferi's Veil", 53, Rarity.UNCOMMON, mage.cards.t.TeferisVeil.class)); cards.add(new SetCardInfo("Tendrils of Despair", 25, Rarity.COMMON, mage.cards.t.TendrilsOfDespair.class)); cards.add(new SetCardInfo("Thunderbolt", 115, Rarity.COMMON, mage.cards.t.Thunderbolt.class)); cards.add(new SetCardInfo("Thundermare", 116, Rarity.RARE, mage.cards.t.Thundermare.class)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/add/GainAbilitiesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/add/GainAbilitiesTest.java index 8096df1ee30..8b519b94160 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/add/GainAbilitiesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/add/GainAbilitiesTest.java @@ -14,34 +14,34 @@ public class GainAbilitiesTest extends CardTestPlayerBase { /* Reported bug: Behind the Scenes grants skulk to all creatures instead of just ones under owner's control - */ + */ @Test public void behindTheScenesShouldOnlyGrantSkulkToCreaturesYouControl() { - + /* Behind the Scenes {2}{B} Enchantment Creatures you control have skulk. (They can't be blocked by creatures with greater power.) {4}{W}: Creatures you control get +1/+1 until end of turn - */ - String bScenes = "Behind the Scenes"; + */ + String bScenes = "Behind the Scenes"; String hGiant = "Hill Giant"; // {3}{R} 3/3 String bSable = "Bronze Sable"; // {2} 2/1 String memnite = "Memnite"; // {0} 1/1 String gBears = "Grizzly Bears"; // {1}{G} 2/2 - + addCard(Zone.BATTLEFIELD, playerA, bScenes); addCard(Zone.BATTLEFIELD, playerA, hGiant); addCard(Zone.BATTLEFIELD, playerA, bSable); addCard(Zone.BATTLEFIELD, playerB, memnite); addCard(Zone.BATTLEFIELD, playerB, gBears); - + setStopAt(1, PhaseStep.PRECOMBAT_MAIN); execute(); - - assertAbility(playerA, hGiant, SkulkAbility.getInstance(), true); - assertAbility(playerA, bSable, SkulkAbility.getInstance(), true); - assertAbility(playerB, memnite, SkulkAbility.getInstance(), false); - assertAbility(playerB, gBears, SkulkAbility.getInstance(), false); + + assertAbility(playerA, hGiant, new SkulkAbility(), true); + assertAbility(playerA, bSable, new SkulkAbility(), true); + assertAbility(playerB, memnite, new SkulkAbility(), false); + assertAbility(playerB, gBears, new SkulkAbility(), false); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopyTargetSpellEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopyTargetSpellEffect.java index 567dac9b351..56d50b8c409 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopyTargetSpellEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopyTargetSpellEffect.java @@ -43,17 +43,30 @@ import mage.players.Player; */ public class CopyTargetSpellEffect extends OneShotEffect { + private boolean useLKI = false; + public CopyTargetSpellEffect() { super(Outcome.Copy); } + public CopyTargetSpellEffect(boolean useLKI) { + super(Outcome.Copy); + this.useLKI = useLKI; + } + public CopyTargetSpellEffect(final CopyTargetSpellEffect effect) { super(effect); + this.useLKI = effect.useLKI; } @Override public boolean apply(Game game, Ability source) { - Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); + Spell spell; + if (useLKI) { + spell = game.getSpellOrLKIStack(targetPointer.getFirst(game, source)); + } else { + spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); + } if (spell == null) { spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK); } diff --git a/Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java b/Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java index f97d4763a96..2378f0a9db6 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java @@ -5,12 +5,11 @@ */ package mage.abilities.keyword; -import java.io.ObjectStreamException; import mage.abilities.Ability; -import mage.abilities.EvasionAbility; -import mage.abilities.MageSingleton; +import mage.abilities.StaticAbility; import mage.abilities.effects.RestrictionEffect; import mage.constants.Duration; +import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; @@ -18,31 +17,26 @@ import mage.game.permanent.Permanent; * * @author LevelX2 */ -public class SkulkAbility extends EvasionAbility implements MageSingleton { +public class SkulkAbility extends StaticAbility { - private static final SkulkAbility instance = new SkulkAbility(); - - private Object readResolve() throws ObjectStreamException { - return instance; + public SkulkAbility() { + super(Zone.BATTLEFIELD, new SkulkEffect(Duration.WhileOnBattlefield)); } - public static SkulkAbility getInstance() { - return instance; - } - - private SkulkAbility() { - this.addEffect(new SkulkEffect(Duration.WhileOnBattlefield)); + public SkulkAbility(final SkulkAbility ability) { + super(ability); } @Override public Ability copy() { - return instance; + return new SkulkAbility(this); } @Override public String getRule() { return "Skulk (This creature can't be blocked by creatures with greater power.)"; } + } class SkulkEffect extends RestrictionEffect { diff --git a/Mage/src/main/java/mage/cards/repository/CardRepository.java b/Mage/src/main/java/mage/cards/repository/CardRepository.java index 36a866cf23a..87239f4c121 100644 --- a/Mage/src/main/java/mage/cards/repository/CardRepository.java +++ b/Mage/src/main/java/mage/cards/repository/CardRepository.java @@ -58,7 +58,7 @@ public enum CardRepository { // raise this if db structure was changed private static final long CARD_DB_VERSION = 51; // raise this if new cards were added to the server - private static final long CARD_CONTENT_VERSION = 91; + private static final long CARD_CONTENT_VERSION = 92; private Dao cardDao; private Set classNames; diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index 51057ed86bb..cc7ff45b3e1 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -87,6 +87,7 @@ public enum CounterType { M1M1(new BoostCounter(-1, -1).name), M2M1(new BoostCounter(-2, -1).name), M2M2(new BoostCounter(-2, -2).name), + MINE("mine"), MINING("mining"), MIRE("mire"), MUSTER("muster"), diff --git a/Mage/src/main/java/mage/game/Game.java b/Mage/src/main/java/mage/game/Game.java index 9ac4302df8e..044e6a3ae79 100644 --- a/Mage/src/main/java/mage/game/Game.java +++ b/Mage/src/main/java/mage/game/Game.java @@ -57,6 +57,7 @@ import mage.game.match.MatchType; import mage.game.permanent.Battlefield; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentCard; +import mage.game.stack.Spell; import mage.game.stack.SpellStack; import mage.game.turn.Phase; import mage.game.turn.Step; @@ -106,6 +107,10 @@ public interface Game extends MageItem, Serializable { UUID getOwnerId(MageObject object); + Spell getSpell(UUID spellId); + + Spell getSpellOrLKIStack(UUID spellId); + Permanent getPermanent(UUID permanentId); Permanent getPermanentOrLKIBattlefield(UUID permanentId); diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index b1856a43dc8..bf310a6d29c 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -445,6 +445,20 @@ public abstract class GameImpl implements Game, Serializable { return null; } + @Override + public Spell getSpell(UUID spellId) { + return state.getStack().getSpell(spellId); + } + + @Override + public Spell getSpellOrLKIStack(UUID spellId) { + Spell spell = state.getStack().getSpell(spellId); + if (spell == null) { + spell = (Spell) this.getLastKnownInformation(spellId, Zone.STACK); + } + return spell; + } + @Override public Permanent getPermanent(UUID permanentId) { return state.getPermanent(permanentId); diff --git a/Mage/src/main/java/mage/game/permanent/token/GeminiEngineTwinToken.java b/Mage/src/main/java/mage/game/permanent/token/GeminiEngineTwinToken.java new file mode 100644 index 00000000000..b7f169cde18 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/GeminiEngineTwinToken.java @@ -0,0 +1,17 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +public class GeminiEngineTwinToken extends Token { + + public GeminiEngineTwinToken(int power, int toughness) { + super("Twin", "colorless Construct artifact creature token named Twin that's attacking. Its power is equal to Gemini Engine's power and its toughness is equal to Gemini Engine's toughness."); + cardType.add(CardType.ARTIFACT); + cardType.add(CardType.CREATURE); + subtype.add(SubType.CONSTRUCT); + this.power = new MageInt(power); + this.toughness = new MageInt(toughness); + } +} diff --git a/Utils/keywords.txt b/Utils/keywords.txt index f2c980846b1..875ab52c008 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -76,7 +76,7 @@ Shadow|instance| Shroud|instance| Soulbond|instance| Soulshift|number| -Skulk|instance| +Skulk|new| Storm|new| Sunburst|new| Swampcycling|cost|