diff --git a/Mage.Sets/src/mage/sets/commander/RikuOfTwoReflections.java b/Mage.Sets/src/mage/sets/commander/RikuOfTwoReflections.java
index badc985d95d..9f38b964529 100644
--- a/Mage.Sets/src/mage/sets/commander/RikuOfTwoReflections.java
+++ b/Mage.Sets/src/mage/sets/commander/RikuOfTwoReflections.java
@@ -161,18 +161,13 @@ class RikuOfTwoReflectionsCopyTokenEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
- Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
- if (permanent == null) {
- permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
- }
-
+ Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
if (permanent != null) {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(permanent);
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true;
}
-
return false;
}
}
diff --git a/Mage.Sets/src/mage/sets/fatereforged/GrimContest.java b/Mage.Sets/src/mage/sets/fatereforged/GrimContest.java
new file mode 100644
index 00000000000..39838df5c95
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/fatereforged/GrimContest.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.fatereforged;
+
+import java.util.UUID;
+import mage.abilities.Ability;
+import mage.abilities.effects.OneShotEffect;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Outcome;
+import mage.constants.Rarity;
+import mage.constants.TargetController;
+import mage.filter.common.FilterCreaturePermanent;
+import mage.filter.predicate.permanent.ControllerPredicate;
+import mage.game.Game;
+import mage.game.permanent.Permanent;
+import mage.players.Player;
+import mage.target.TargetPermanent;
+import mage.target.common.TargetControlledCreaturePermanent;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class GrimContest extends CardImpl {
+
+ private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
+
+ static {
+ filter.add(new ControllerPredicate(TargetController.OPPONENT));
+ }
+
+ public GrimContest(UUID ownerId) {
+ super(ownerId, 153, "Grim Contest", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{B}{G}");
+ this.expansionSetCode = "FRF";
+
+ // Choose target creature you control and target creature an opponent controls. Each of those creatures deals damage equal to its toughness to the other.
+ this.getSpellAbility().addEffect(new GrimContestEffect());
+ this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
+ this.getSpellAbility().addTarget(new TargetPermanent(filter));
+ }
+
+ public GrimContest(final GrimContest card) {
+ super(card);
+ }
+
+ @Override
+ public GrimContest copy() {
+ return new GrimContest(this);
+ }
+}
+
+class GrimContestEffect extends OneShotEffect {
+
+ public GrimContestEffect() {
+ super(Outcome.Damage);
+ this.staticText = "Choose target creature you control and target creature an opponent controls. Each of those creatures deals damage equal to its toughness to the other";
+ }
+
+ public GrimContestEffect(final GrimContestEffect effect) {
+ super(effect);
+ }
+
+ @Override
+ public GrimContestEffect copy() {
+ return new GrimContestEffect(this);
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ Player controller = game.getPlayer(source.getControllerId());
+ if (controller != null) {
+ Permanent creature1 = game.getPermanent(getTargetPointer().getFirst(game, source));
+ Permanent creature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget());
+ if (creature1 != null && creature2 != null) {
+ if (creature1.getCardType().contains(CardType.CREATURE) && creature2.getCardType().contains(CardType.CREATURE)) {
+ creature1.damage(creature2.getToughness().getValue(), creature2.getId(), game, false, true);
+ game.informPlayers(creature2.getLogName() + " deals " + creature2.getToughness().getValue() + " damage to " + creature1.getLogName());
+ creature2.damage(creature1.getToughness().getValue(), creature1.getId(), game, false, true);
+ game.informPlayers(creature1.getLogName() + " deals " + creature1.getToughness().getValue() + " damage to " + creature2.getLogName());
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/fatereforged/HarshSustenance.java b/Mage.Sets/src/mage/sets/fatereforged/HarshSustenance.java
new file mode 100644
index 00000000000..fb7efe69884
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/fatereforged/HarshSustenance.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.fatereforged;
+
+import java.util.UUID;
+import mage.abilities.dynamicvalue.DynamicValue;
+import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
+import mage.abilities.effects.Effect;
+import mage.abilities.effects.common.DamageTargetEffect;
+import mage.abilities.effects.common.GainLifeEffect;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Rarity;
+import mage.filter.common.FilterControlledCreaturePermanent;
+import mage.target.common.TargetCreatureOrPlayer;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class HarshSustenance extends CardImpl {
+
+ public HarshSustenance(UUID ownerId) {
+ super(ownerId, 154, "Harsh Sustenance", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{W}{B}");
+ this.expansionSetCode = "FRF";
+
+ // Harsh Sustenance deals X damage to target creature or player and you gain X life, where X is the number of creatures you control.
+ DynamicValue xValue = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent());
+ Effect effect = new DamageTargetEffect(xValue);
+ effect.setText("{this} deals X damage to target creature or player");
+ getSpellAbility().addEffect(effect);
+ getSpellAbility().addTarget(new TargetCreatureOrPlayer());
+ effect = new GainLifeEffect(xValue);
+ effect.setText("and you gain X life, where X is the number of creatures you control");
+ getSpellAbility().addEffect(effect);
+ }
+
+ public HarshSustenance(final HarshSustenance card) {
+ super(card);
+ }
+
+ @Override
+ public HarshSustenance copy() {
+ return new HarshSustenance(this);
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/fatereforged/RealityShift.java b/Mage.Sets/src/mage/sets/fatereforged/RealityShift.java
new file mode 100644
index 00000000000..2f70b19294b
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/fatereforged/RealityShift.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.fatereforged;
+
+import java.util.UUID;
+import mage.abilities.Ability;
+import mage.abilities.effects.Effect;
+import mage.abilities.effects.OneShotEffect;
+import mage.abilities.effects.common.ExileTargetEffect;
+import mage.abilities.effects.keyword.ManifestTargetPlayerEffect;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Outcome;
+import mage.constants.Rarity;
+import mage.game.Game;
+import mage.game.permanent.Permanent;
+import mage.target.common.TargetCreaturePermanent;
+import mage.target.targetpointer.FixedTarget;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class RealityShift extends CardImpl {
+
+ public RealityShift(UUID ownerId) {
+ super(ownerId, 46, "Reality Shift", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
+ this.expansionSetCode = "FRF";
+
+ // Exile target creature. Its controller manifests the top card of his or her library.
+ this.getSpellAbility().addEffect(new ExileTargetEffect());
+ this.getSpellAbility().addEffect(new RealityShiftEffect());
+ this.getSpellAbility().addTarget(new TargetCreaturePermanent());
+
+ }
+
+ public RealityShift(final RealityShift card) {
+ super(card);
+ }
+
+ @Override
+ public RealityShift copy() {
+ return new RealityShift(this);
+ }
+}
+
+class RealityShiftEffect extends OneShotEffect {
+
+ public RealityShiftEffect() {
+ super(Outcome.Exile);
+ this.staticText = "Its controller manifests the top card of his or her library. (That player puts the top card of his or her library onto the battlefield face down as a 2/2 creature. If it's a creature card, it can be turned face up any time for its mana cost.)";
+ }
+
+ public RealityShiftEffect(final RealityShiftEffect effect) {
+ super(effect);
+ }
+
+ @Override
+ public RealityShiftEffect copy() {
+ return new RealityShiftEffect(this);
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ Permanent targetCreature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
+ if (targetCreature != null) {
+ Effect effect = new ManifestTargetPlayerEffect(1, "Its controller");
+ effect.setTargetPointer(new FixedTarget(targetCreature.getControllerId()));
+ return effect.apply(game, source);
+ }
+ return false;
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/fatereforged/SageEyeAvengers.java b/Mage.Sets/src/mage/sets/fatereforged/SageEyeAvengers.java
new file mode 100644
index 00000000000..f14d8c67ae7
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/fatereforged/SageEyeAvengers.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.fatereforged;
+
+import java.util.UUID;
+import mage.MageInt;
+import mage.MageObject;
+import mage.abilities.Ability;
+import mage.abilities.common.AttacksTriggeredAbility;
+import mage.abilities.effects.OneShotEffect;
+import mage.abilities.keyword.ProwessAbility;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Outcome;
+import mage.constants.Rarity;
+import mage.constants.Zone;
+import mage.game.Game;
+import mage.game.permanent.Permanent;
+import mage.players.Player;
+import mage.target.common.TargetCreaturePermanent;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class SageEyeAvengers extends CardImpl {
+
+ public SageEyeAvengers(UUID ownerId) {
+ super(ownerId, 50, "Sage-Eye Avengers", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
+ this.expansionSetCode = "FRF";
+ this.subtype.add("Djinn");
+ this.subtype.add("Monk");
+ this.power = new MageInt(4);
+ this.toughness = new MageInt(5);
+
+ // Prowess
+ this.addAbility(new ProwessAbility());
+
+ // Whenever Sage-Eye Avengers attacks, you may return target creature to its owner's hand if its power is less than Sage-Eye Avengers's power.
+ Ability ability = new AttacksTriggeredAbility(new SageEyeAvengersEffect(), true);
+ ability.addTarget(new TargetCreaturePermanent());
+ this.addAbility(ability);
+ }
+
+ public SageEyeAvengers(final SageEyeAvengers card) {
+ super(card);
+ }
+
+ @Override
+ public SageEyeAvengers copy() {
+ return new SageEyeAvengers(this);
+ }
+}
+
+class SageEyeAvengersEffect extends OneShotEffect {
+
+ public SageEyeAvengersEffect() {
+ super(Outcome.ReturnToHand);
+ this.staticText = "you may return target creature to its owner's hand if its power is less than {this}'s power";
+ }
+
+ public SageEyeAvengersEffect(final SageEyeAvengersEffect effect) {
+ super(effect);
+ }
+
+ @Override
+ public SageEyeAvengersEffect copy() {
+ return new SageEyeAvengersEffect(this);
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ Player controller = game.getPlayer(source.getControllerId());
+ MageObject sourceObject = game.getObject(source.getSourceId());
+ if (sourceObject != null && controller != null) {
+ Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
+ if (targetCreature != null && targetCreature.getPower().getValue() < sourceObject.getPower().getValue()) {
+ controller.moveCardToHandWithInfo(targetCreature, source.getSourceId(), game, Zone.BATTLEFIELD);
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/fatereforged/ShiftingLoyalties.java b/Mage.Sets/src/mage/sets/fatereforged/ShiftingLoyalties.java
new file mode 100644
index 00000000000..be282207e16
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/fatereforged/ShiftingLoyalties.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.fatereforged;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+import mage.MageObject;
+import mage.abilities.Ability;
+import mage.abilities.effects.common.continious.ExchangeControlTargetEffect;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Duration;
+import mage.constants.Rarity;
+import mage.filter.FilterPermanent;
+import mage.game.Game;
+import mage.game.permanent.Permanent;
+import mage.target.TargetPermanent;
+import mage.util.CardUtil;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class ShiftingLoyalties extends CardImpl {
+
+ public ShiftingLoyalties(UUID ownerId) {
+ super(ownerId, 51, "Shifting Loyalties", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{5}{U}");
+ this.expansionSetCode = "FRF";
+
+ // Exchange control of two target permanents that share a card type. (Artifact, creature, enchantment, land, and planeswalker are card types.)
+ this.getSpellAbility().addEffect(new ExchangeControlTargetEffect(Duration.EndOfGame, "Exchange control of two target permanents that share a card type. (Artifact, creature, enchantment, land, and planeswalker are card types.)"));
+ this.getSpellAbility().addTarget(new TargetpermanentsThatShareCardType());
+
+ }
+
+ public ShiftingLoyalties(final ShiftingLoyalties card) {
+ super(card);
+ }
+
+ @Override
+ public ShiftingLoyalties copy() {
+ return new ShiftingLoyalties(this);
+ }
+}
+
+class TargetpermanentsThatShareCardType extends TargetPermanent {
+
+ public TargetpermanentsThatShareCardType() {
+ super(2, 2, new FilterPermanent(), false);
+ targetName = "permanents that share a card type";
+ }
+
+ public TargetpermanentsThatShareCardType(final TargetpermanentsThatShareCardType target) {
+ super(target);
+ }
+
+ @Override
+ public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
+ if (super.canTarget(controllerId, id, source, game)) {
+ if (!getTargets().isEmpty()) {
+ Permanent targetOne = game.getPermanent(getTargets().get(0));
+ Permanent targetTwo = game.getPermanent(id);
+ if (targetOne == null || targetTwo == null) {
+ return false;
+ }
+ return CardUtil.shareTypes(targetOne, targetTwo);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
+ Set cardTypes = new HashSet<>();
+ MageObject targetSource = game.getObject(sourceId);
+ for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
+ if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game)) {
+ for (CardType cardType :permanent.getCardType()) {
+ if (cardTypes.contains(cardType)) {
+ return true;
+ }
+ }
+ cardTypes.addAll(permanent.getCardType());
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public TargetpermanentsThatShareCardType copy() {
+ return new TargetpermanentsThatShareCardType(this);
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/fatereforged/ShuYunTheSilentTempest.java b/Mage.Sets/src/mage/sets/fatereforged/ShuYunTheSilentTempest.java
new file mode 100644
index 00000000000..3effd5f3118
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/fatereforged/ShuYunTheSilentTempest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.fatereforged;
+
+import java.util.UUID;
+import mage.MageInt;
+import mage.abilities.Ability;
+import mage.abilities.common.SpellCastControllerTriggeredAbility;
+import mage.abilities.costs.mana.ManaCostsImpl;
+import mage.abilities.effects.common.DoIfCostPaid;
+import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
+import mage.abilities.keyword.DoubleStrikeAbility;
+import mage.abilities.keyword.ProwessAbility;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Duration;
+import mage.constants.Rarity;
+import mage.filter.FilterSpell;
+import mage.filter.predicate.Predicates;
+import mage.filter.predicate.mageobject.CardTypePredicate;
+import mage.target.common.TargetCreaturePermanent;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class ShuYunTheSilentTempest extends CardImpl {
+
+ private static final FilterSpell filter = new FilterSpell("a noncreature spell");
+
+ static {
+ filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
+ }
+
+ public ShuYunTheSilentTempest(UUID ownerId) {
+ super(ownerId, 52, "Shu Yun, the Silent Tempest", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}");
+ this.expansionSetCode = "FRF";
+ this.supertype.add("Legendary");
+ this.subtype.add("Human");
+ this.subtype.add("Monk");
+ this.power = new MageInt(3);
+ this.toughness = new MageInt(2);
+
+ // Prowess
+ this.addAbility(new ProwessAbility());
+ // Whenever you cast a noncreature spell, you may pay {R/W}{R/W}. If you do, target creature gains double strike until end of turn.
+ Ability ability = new SpellCastControllerTriggeredAbility(
+ new DoIfCostPaid(
+ new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn),
+ new ManaCostsImpl("{R/W}{R/W}"),
+ "Pay to let target creature gain double strike?"),
+ filter, false);
+ ability.addTarget(new TargetCreaturePermanent());
+ this.addAbility(ability);
+
+
+ }
+
+ public ShuYunTheSilentTempest(final ShuYunTheSilentTempest card) {
+ super(card);
+ }
+
+ @Override
+ public ShuYunTheSilentTempest copy() {
+ return new ShuYunTheSilentTempest(this);
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/fatereforged/SupplantForm.java b/Mage.Sets/src/mage/sets/fatereforged/SupplantForm.java
new file mode 100644
index 00000000000..13914d02aac
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/fatereforged/SupplantForm.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.fatereforged;
+
+import java.util.UUID;
+import mage.abilities.Ability;
+import mage.abilities.effects.OneShotEffect;
+import mage.abilities.effects.common.ReturnToHandTargetEffect;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Outcome;
+import mage.constants.Rarity;
+import mage.game.Game;
+import mage.game.permanent.Permanent;
+import mage.game.permanent.token.EmptyToken;
+import mage.target.common.TargetCreaturePermanent;
+import mage.util.CardUtil;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class SupplantForm extends CardImpl {
+
+ public SupplantForm(UUID ownerId) {
+ super(ownerId, 54, "Supplant Form", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{4}{U}{U}");
+ this.expansionSetCode = "FRF";
+
+ // Return target creature to its owner's hand. You put a token onto the battlefield that's a copy of that creature.
+ this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
+ this.getSpellAbility().addTarget(new TargetCreaturePermanent());
+ this.getSpellAbility().addEffect(new SupplantFormEffect());
+ }
+
+ public SupplantForm(final SupplantForm card) {
+ super(card);
+ }
+
+ @Override
+ public SupplantForm copy() {
+ return new SupplantForm(this);
+ }
+}
+
+class SupplantFormEffect extends OneShotEffect {
+
+ public SupplantFormEffect() {
+ super(Outcome.PutCreatureInPlay);
+ this.staticText = "You put a token onto the battlefield that's a copy of that creature";
+ }
+
+ public SupplantFormEffect(final SupplantFormEffect effect) {
+ super(effect);
+ }
+
+ @Override
+ public SupplantFormEffect copy() {
+ return new SupplantFormEffect(this);
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ Permanent targetPermanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
+ if (targetPermanent != null) {
+ EmptyToken token = new EmptyToken();
+ CardUtil.copyTo(token).from(targetPermanent);
+ token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/fatereforged/TorrentElemental.java b/Mage.Sets/src/mage/sets/fatereforged/TorrentElemental.java
new file mode 100644
index 00000000000..a4bbe3f58f3
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/fatereforged/TorrentElemental.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.fatereforged;
+
+import java.util.UUID;
+import mage.MageInt;
+import mage.abilities.Ability;
+import mage.abilities.common.ActivateAsSorceryActivatedAbility;
+import mage.abilities.common.AttacksTriggeredAbility;
+import mage.abilities.costs.mana.ManaCostsImpl;
+import mage.abilities.effects.OneShotEffect;
+import mage.abilities.keyword.FlyingAbility;
+import mage.cards.Card;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Outcome;
+import mage.constants.Rarity;
+import mage.constants.SetTargetPointer;
+import mage.constants.Zone;
+import mage.filter.common.FilterCreaturePermanent;
+import mage.game.Game;
+import mage.game.permanent.Permanent;
+import mage.players.Player;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class TorrentElemental extends CardImpl {
+
+ public TorrentElemental(UUID ownerId) {
+ super(ownerId, 56, "Torrent Elemental", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{U}");
+ this.expansionSetCode = "FRF";
+ this.subtype.add("Elemental");
+ this.power = new MageInt(3);
+ this.toughness = new MageInt(5);
+
+ // Flying
+ this.addAbility(FlyingAbility.getInstance());
+ // Whenever Torrent Elemental attacks, tap all creatures defending player controls.
+ this.addAbility(new AttacksTriggeredAbility(new TorrentElementalEffect(), false, null, SetTargetPointer.PLAYER));
+
+ // {3}{B/G}{B/G}: Put Torrent Elemental from exile onto the battlefield tapped. Activate this ability only any time you could cast a sorcery.
+ Ability ability = new ActivateAsSorceryActivatedAbility(Zone.EXILED, new ReturnSourceFromExileToBattlefieldEffect(true), new ManaCostsImpl("{3}{B/G}{B/G}"));
+ this.addAbility(ability);
+
+ }
+
+ public TorrentElemental(final TorrentElemental card) {
+ super(card);
+ }
+
+ @Override
+ public TorrentElemental copy() {
+ return new TorrentElemental(this);
+ }
+}
+
+class TorrentElementalEffect extends OneShotEffect {
+
+ public TorrentElementalEffect() {
+ super(Outcome.Tap);
+ this.staticText = "tap all creatures defending player controls";
+ }
+
+ public TorrentElementalEffect(final TorrentElementalEffect effect) {
+ super(effect);
+ }
+
+ @Override
+ public TorrentElementalEffect copy() {
+ return new TorrentElementalEffect(this);
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), getTargetPointer().getFirst(game, source), game)) {
+ permanent.tap(game);
+ }
+ return true;
+ }
+}
+
+class ReturnSourceFromExileToBattlefieldEffect extends OneShotEffect {
+
+ private boolean tapped;
+ private boolean ownerControl;
+
+ public ReturnSourceFromExileToBattlefieldEffect() {
+ this(false);
+ }
+
+ public ReturnSourceFromExileToBattlefieldEffect(boolean tapped) {
+ super(Outcome.PutCreatureInPlay);
+ this.tapped = tapped;
+ setText();
+ }
+ public ReturnSourceFromExileToBattlefieldEffect(boolean tapped, boolean ownerControl) {
+ super(Outcome.PutCreatureInPlay);
+ this.tapped = tapped;
+ this.ownerControl = ownerControl;
+ setText();
+ }
+
+ public ReturnSourceFromExileToBattlefieldEffect(final ReturnSourceFromExileToBattlefieldEffect effect) {
+ super(effect);
+ this.tapped = effect.tapped;
+ this.ownerControl = effect.ownerControl;
+ }
+
+ @Override
+ public ReturnSourceFromExileToBattlefieldEffect copy() {
+ return new ReturnSourceFromExileToBattlefieldEffect(this);
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ if (!game.getState().getZone(source.getSourceId()).equals(Zone.EXILED)) {
+ return false;
+ }
+ Card card = game.getCard(source.getSourceId());
+ if (card == null) {
+ return false;
+ }
+
+ Player player;
+ if (ownerControl) {
+ player = game.getPlayer(card.getOwnerId());
+ } else {
+ player = game.getPlayer(source.getControllerId());
+ }
+ if (player == null) {
+ return false;
+ }
+
+ return player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId(), tapped);
+ }
+
+ private void setText() {
+ StringBuilder sb = new StringBuilder("Put {this} from exile onto the battlefield");
+ if (tapped) {
+ sb.append(" tapped");
+ }
+ if (ownerControl) {
+ sb.append(" under its owner's control");
+ }
+ staticText = sb.toString();
+ }
+
+}
\ No newline at end of file
diff --git a/Mage.Sets/src/mage/sets/fatereforged/WriteIntoBeing.java b/Mage.Sets/src/mage/sets/fatereforged/WriteIntoBeing.java
new file mode 100644
index 00000000000..601df1b7a69
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/fatereforged/WriteIntoBeing.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.fatereforged;
+
+import java.util.UUID;
+import mage.MageObject;
+import mage.abilities.Ability;
+import mage.abilities.effects.OneShotEffect;
+import mage.abilities.effects.keyword.ManifestEffect;
+import mage.cards.Card;
+import mage.cards.CardImpl;
+import mage.cards.Cards;
+import mage.cards.CardsImpl;
+import mage.constants.CardType;
+import mage.constants.Outcome;
+import mage.constants.Rarity;
+import mage.constants.Zone;
+import mage.filter.FilterCard;
+import mage.game.Game;
+import mage.players.Player;
+import mage.target.TargetCard;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class WriteIntoBeing extends CardImpl {
+
+ public WriteIntoBeing(UUID ownerId) {
+ super(ownerId, 59, "Write into Being", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{U}");
+ this.expansionSetCode = "FRF";
+
+ // Look at the top two cards of your library. Manifest one of those cards, then put the other on the top or bottom of your library.
+ this.getSpellAbility().addEffect(new WriteIntoBeingEffect());
+ }
+
+ public WriteIntoBeing(final WriteIntoBeing card) {
+ super(card);
+ }
+
+ @Override
+ public WriteIntoBeing copy() {
+ return new WriteIntoBeing(this);
+ }
+}
+
+class WriteIntoBeingEffect extends OneShotEffect {
+
+ public WriteIntoBeingEffect() {
+ super(Outcome.PutCreatureInPlay);
+ this.staticText = "Look at the top two cards of your library. Manifest one of those cards, then put the other on the top or bottom of your library. (To manifest a card, put it onto the battlefield face down as a 2/2 creature. Turn it face up any time for its mana cost if it's a creature card.)";
+ }
+
+ public WriteIntoBeingEffect(final WriteIntoBeingEffect effect) {
+ super(effect);
+ }
+
+ @Override
+ public WriteIntoBeingEffect copy() {
+ return new WriteIntoBeingEffect(this);
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ Player controller = game.getPlayer(source.getControllerId());
+ MageObject sourceObject = game.getObject(source.getSourceId());
+ if (sourceObject != null && controller != null) {
+ Cards cards = new CardsImpl();
+ cards.addAll(controller.getLibrary().getTopCards(game, 2));
+ controller.lookAtCards(sourceObject.getLogName(), cards, game);
+ Card cardToManifest = null;
+ if (cards.size() > 1) {
+ TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to manifest"));
+ if (controller.chooseTarget(outcome, cards, target, source, game)) {
+ cardToManifest = cards.get(target.getFirstTarget(), game);
+ }
+ } else {
+ cardToManifest = cards.getRandom(game);
+ }
+ if (!controller.getLibrary().getFromTop(game).equals(cardToManifest)) {
+ Card cardToPutBack = controller.getLibrary().removeFromTop(game);
+ cardToManifest = controller.getLibrary().removeFromTop(game);
+ controller.getLibrary().putOnTop(cardToPutBack, game);
+ controller.getLibrary().putOnTop(cardToManifest, game);
+ }
+ new ManifestEffect(1).apply(game, source);
+ if (controller.getLibrary().size() > 0) {
+ Card cardToPutBack = controller.getLibrary().removeFromTop(game);
+ if (controller.chooseUse(Outcome.Detriment, "Put " + cardToPutBack.getName() + " on buttom of library?", game)) {
+ controller.moveCardToLibraryWithInfo(cardToPutBack, source.getSourceId(), game, Zone.LIBRARY, false, false);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/Mage/src/mage/abilities/common/AttacksTriggeredAbility.java b/Mage/src/mage/abilities/common/AttacksTriggeredAbility.java
index 3f1ade5d1d7..e8cea4c144d 100644
--- a/Mage/src/mage/abilities/common/AttacksTriggeredAbility.java
+++ b/Mage/src/mage/abilities/common/AttacksTriggeredAbility.java
@@ -28,12 +28,15 @@
package mage.abilities.common;
+import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
+import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
+import mage.target.targetpointer.FixedTarget;
/**
*
@@ -41,26 +44,44 @@ import mage.game.events.GameEvent.EventType;
*/
public class AttacksTriggeredAbility extends TriggeredAbilityImpl {
+ protected SetTargetPointer setTargetPointer;
protected String text;
public AttacksTriggeredAbility(Effect effect, boolean optional) {
- super(Zone.BATTLEFIELD, effect, optional);
+ this(effect, optional, null);
}
public AttacksTriggeredAbility(Effect effect, boolean optional, String text) {
+ this(effect, optional, text, SetTargetPointer.NONE);
+ }
+
+ public AttacksTriggeredAbility(Effect effect, boolean optional, String text, SetTargetPointer setTargetPointer) {
super(Zone.BATTLEFIELD, effect, optional);
this.text = text;
+ this.setTargetPointer = setTargetPointer;
}
public AttacksTriggeredAbility(final AttacksTriggeredAbility ability) {
super(ability);
this.text = ability.text;
+ this.setTargetPointer = ability.setTargetPointer;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.DECLARED_ATTACKERS
&& game.getCombat().getAttackers().contains(this.getSourceId()) ) {
+ switch(setTargetPointer) {
+ case PLAYER:
+ UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(getSourceId(), game);
+ if (defendingPlayerId != null) {
+ for (Effect effect: getEffects()) {
+ effect.setTargetPointer(new FixedTarget(defendingPlayerId));
+ }
+ }
+ break;
+
+ }
return true;
}
return false;
diff --git a/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java
index 3b39158ca9c..ddfc2a1c260 100644
--- a/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java
+++ b/Mage/src/mage/abilities/effects/common/continious/GainAbilityTargetEffect.java
@@ -164,7 +164,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" gain ");
} else {
if (!target.getTargetName().toUpperCase().startsWith("ANOTHER")) {
- sb.append("Target ");
+ sb.append("target ");
}
sb.append(target.getTargetName()).append(" gains ");
diff --git a/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java b/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.java
new file mode 100644
index 00000000000..eea0163b2fc
--- /dev/null
+++ b/Mage/src/mage/abilities/effects/keyword/ManifestTargetPlayerEffect.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.abilities.effects.keyword;
+
+import java.util.List;
+import mage.abilities.Ability;
+import mage.abilities.costs.mana.ManaCosts;
+import mage.abilities.costs.mana.ManaCostsImpl;
+import mage.abilities.effects.ContinuousEffect;
+import mage.abilities.effects.OneShotEffect;
+import mage.abilities.effects.common.continious.BecomesFaceDownCreatureEffect;
+import mage.cards.Card;
+import mage.constants.CardType;
+import mage.constants.Duration;
+import mage.constants.Outcome;
+import mage.constants.Zone;
+import mage.game.Game;
+import mage.players.Player;
+import mage.target.targetpointer.FixedTarget;
+import mage.util.CardUtil;
+
+/**
+ *
+ * @author LevelX2
+ */
+
+public class ManifestTargetPlayerEffect extends OneShotEffect {
+
+ private final int amount;
+ private final String prefix;
+
+ public ManifestTargetPlayerEffect(int amount, String prefix) {
+ super(Outcome.PutCreatureInPlay);
+ this.amount = amount;
+ this.prefix = prefix;
+ this.staticText = setText();
+ }
+
+ public ManifestTargetPlayerEffect(final ManifestTargetPlayerEffect effect) {
+ super(effect);
+ this.amount = effect.amount;
+ this.prefix = effect.prefix;
+ }
+
+ @Override
+ public ManifestTargetPlayerEffect copy() {
+ return new ManifestTargetPlayerEffect(this);
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
+ if (targetPlayer != null) {
+ List cards = targetPlayer.getLibrary().getTopCards(game, amount);
+ for (Card card: cards) {
+ card.setFaceDown(true);
+ targetPlayer.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
+ ManaCosts manaCosts = null;
+ if (card.getCardType().contains(CardType.CREATURE)) {
+ manaCosts = card.getSpellAbility().getManaCosts();
+ if (manaCosts == null) {
+ manaCosts = new ManaCostsImpl("{0}");
+ }
+ }
+ ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom);
+ effect.setTargetPointer(new FixedTarget(card.getId()));
+ game.addEffect(effect, source);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private String setText() {
+ StringBuilder sb = new StringBuilder();
+ if (prefix != null && !prefix.isEmpty()) {
+ sb.append(prefix).append(" ");
+ }
+ sb.append("manifest the top ");
+ if (amount > 1) {
+ sb.append(CardUtil.numberToText(amount)).append(" cards ");
+ } else {
+ sb.append("card ");
+ }
+ sb.append("of his or her library. ");
+ if (amount > 1) {
+ sb.append("(To manifest a card, put it onto the battlefield face down as a 2/2 creature. The controller may turn it face up at any time for its mana cost if it's a creature card.)");
+ } else {
+ sb.append("(That player puts the top card of his or her library onto the battlefield face down as a 2/2 creature. If it's a creature card, it can be turned face up any time for its mana cost.)");
+ }
+ return sb.toString();
+ }
+}