diff --git a/Mage.Sets/src/mage/sets/kaladesh/AcrobaticManeuver.java b/Mage.Sets/src/mage/sets/kaladesh/AcrobaticManeuver.java
new file mode 100644
index 00000000000..551fc98767e
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/kaladesh/AcrobaticManeuver.java
@@ -0,0 +1,69 @@
+/*
+ * 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.kaladesh;
+
+import java.util.UUID;
+import mage.abilities.effects.Effect;
+import mage.abilities.effects.common.DrawCardSourceControllerEffect;
+import mage.abilities.effects.common.ExileTargetForSourceEffect;
+import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Rarity;
+import mage.target.common.TargetControlledCreaturePermanent;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class AcrobaticManeuver extends CardImpl {
+
+ public AcrobaticManeuver(UUID ownerId) {
+ super(ownerId, 1, "Acrobatic Maneuver", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}");
+ this.expansionSetCode = "KLD";
+
+ // Exile target creature you control, then return that card to the battlefield under its owner's control.
+ this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
+ Effect effect = new ExileTargetForSourceEffect();
+ effect.setApplyEffectsAfter();
+ this.getSpellAbility().addEffect(effect);
+ this.getSpellAbility().addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true));
+
+ // Draw a card.
+ this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
+ }
+
+ public AcrobaticManeuver(final AcrobaticManeuver card) {
+ super(card);
+ }
+
+ @Override
+ public AcrobaticManeuver copy() {
+ return new AcrobaticManeuver(this);
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/kaladesh/AerialResponder.java b/Mage.Sets/src/mage/sets/kaladesh/AerialResponder.java
new file mode 100644
index 00000000000..143b3e3b2a0
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/kaladesh/AerialResponder.java
@@ -0,0 +1,69 @@
+/*
+ * 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.kaladesh;
+
+import java.util.UUID;
+import mage.MageInt;
+import mage.abilities.keyword.FlyingAbility;
+import mage.abilities.keyword.VigilanceAbility;
+import mage.abilities.keyword.LifelinkAbility;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Rarity;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class AerialResponder extends CardImpl {
+
+ public AerialResponder(UUID ownerId) {
+ super(ownerId, 2, "Aerial Responder", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");
+ this.expansionSetCode = "KLD";
+ this.subtype.add("Dwarf");
+ this.subtype.add("Soldier");
+ this.power = new MageInt(2);
+ this.toughness = new MageInt(3);
+
+ // Flying
+ this.addAbility(FlyingAbility.getInstance());
+ // Vigilance
+ this.addAbility(VigilanceAbility.getInstance());
+ // Lifelink
+ this.addAbility(LifelinkAbility.getInstance());
+ }
+
+ public AerialResponder(final AerialResponder card) {
+ super(card);
+ }
+
+ @Override
+ public AerialResponder copy() {
+ return new AerialResponder(this);
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/kaladesh/AetherstormRoc.java b/Mage.Sets/src/mage/sets/kaladesh/AetherstormRoc.java
new file mode 100644
index 00000000000..e4b3108de4c
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/kaladesh/AetherstormRoc.java
@@ -0,0 +1,102 @@
+/*
+ * 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.kaladesh;
+
+import java.util.UUID;
+import mage.MageInt;
+import mage.abilities.Ability;
+import mage.abilities.common.AttacksTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.costs.common.PayEnergyCost;
+import mage.abilities.effects.common.DoIfCostPaid;
+import mage.abilities.effects.common.TapTargetEffect;
+import mage.abilities.effects.common.counter.AddCountersSourceEffect;
+import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect;
+import mage.abilities.keyword.FlyingAbility;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Rarity;
+import mage.counters.CounterType;
+import mage.filter.common.FilterCreaturePermanent;
+import mage.filter.predicate.permanent.ControllerIdPredicate;
+import mage.game.Game;
+import mage.target.common.TargetCreaturePermanent;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class AetherstormRoc extends CardImpl {
+
+ private final UUID originalId;
+
+ public AetherstormRoc(UUID ownerId) {
+ super(ownerId, 3, "Aetherstorm Roc", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
+ this.expansionSetCode = "KLD";
+ this.subtype.add("Bird");
+ this.power = new MageInt(3);
+ this.toughness = new MageInt(3);
+
+ // Flying
+ this.addAbility(FlyingAbility.getInstance());
+ // Whenever Aetherstorm Roc or another creature enters the battlefield under your control, you get {E}.
+ this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new GetEnergyCountersControllerEffect(1), new FilterCreaturePermanent("{this} or another creature")));
+
+ // Whenever Aetherstorm Roc attacks, you may pay {E}{E}. If you do, put a +1/+1 counter on it and tap up to one target creature defending player controls.
+ DoIfCostPaid doIfCostPaidEffect = new DoIfCostPaid(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new PayEnergyCost(2));
+ doIfCostPaidEffect.addEffect(new TapTargetEffect());
+ Ability ability = new AttacksTriggeredAbility(doIfCostPaidEffect, false,
+ "Whenever {this} attacks you may pay {E}{E}. If you do, put a +1/+1 counter on it and tap up to one target creature defending player controls.");
+ ability.addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent("creature defending player controls"), false));
+ originalId = ability.getOriginalId();
+ this.addAbility(ability);
+
+ }
+
+ public AetherstormRoc(final AetherstormRoc card) {
+ super(card);
+ this.originalId = card.originalId;
+ }
+
+ @Override
+ public void adjustTargets(Ability ability, Game game) {
+ if (ability.getOriginalId().equals(originalId)) {
+ ability.getTargets().clear();
+ FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
+ UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
+ filter.add(new ControllerIdPredicate(defenderId));
+ TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
+ ability.addTarget(target);
+ }
+ }
+
+ @Override
+ public AetherstormRoc copy() {
+ return new AetherstormRoc(this);
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/kaladesh/AngelOfInvention.java b/Mage.Sets/src/mage/sets/kaladesh/AngelOfInvention.java
new file mode 100644
index 00000000000..5e3d5a473d2
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/kaladesh/AngelOfInvention.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of BetaSteward_at_googlemail.com.
+ */
+package mage.sets.kaladesh;
+
+import java.util.UUID;
+import mage.MageInt;
+import mage.abilities.common.SimpleStaticAbility;
+import mage.abilities.effects.common.continuous.BoostControlledEffect;
+import mage.abilities.keyword.FabricateAbility;
+import mage.abilities.keyword.FlyingAbility;
+import mage.abilities.keyword.LifelinkAbility;
+import mage.abilities.keyword.VigilanceAbility;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Duration;
+import mage.constants.Rarity;
+import mage.constants.Zone;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class AngelOfInvention extends CardImpl {
+
+ public AngelOfInvention(UUID ownerId) {
+ super(ownerId, 4, "Angel of Invention", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
+ this.expansionSetCode = "KLD";
+ this.subtype.add("Angel");
+ this.power = new MageInt(2);
+ this.toughness = new MageInt(1);
+
+ // Flying
+ this.addAbility(FlyingAbility.getInstance());
+ // Vigilance
+ this.addAbility(VigilanceAbility.getInstance());
+ // Lifelink
+ this.addAbility(LifelinkAbility.getInstance());
+ // Fabricate 2
+ this.addAbility(new FabricateAbility(2));
+ // Other creatures you control get +1/+1.
+ this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, true)));
+ }
+
+ public AngelOfInvention(final AngelOfInvention card) {
+ super(card);
+ }
+
+ @Override
+ public AngelOfInvention copy() {
+ return new AngelOfInvention(this);
+ }
+}
diff --git a/Mage.Sets/src/mage/sets/kaladesh/ConsulateSurveillance.java b/Mage.Sets/src/mage/sets/kaladesh/ConsulateSurveillance.java
new file mode 100644
index 00000000000..a05506d8b22
--- /dev/null
+++ b/Mage.Sets/src/mage/sets/kaladesh/ConsulateSurveillance.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.kaladesh;
+
+import java.util.UUID;
+import mage.abilities.common.EntersBattlefieldTriggeredAbility;
+import mage.abilities.common.SimpleActivatedAbility;
+import mage.abilities.costs.common.PayEnergyCost;
+import mage.abilities.effects.common.PreventAllDamageFromChosenSourceToYouEffect;
+import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect;
+import mage.cards.CardImpl;
+import mage.constants.CardType;
+import mage.constants.Duration;
+import mage.constants.Rarity;
+import mage.constants.Zone;
+import mage.filter.FilterObject;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class ConsulateSurveillance extends CardImpl {
+
+ public ConsulateSurveillance(UUID ownerId) {
+ super(ownerId, 10, "Consulate Surveillance", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
+ this.expansionSetCode = "KLD";
+
+ // When Consulate Surveillance enters the battlefield, you get {E}{E}{E}{E}.
+ this.addAbility(new EntersBattlefieldTriggeredAbility(new GetEnergyCountersControllerEffect(4)));
+
+ // Pay {E}{E}: Prevent all damage that would be dealt to you this turn by a source of your choice.
+ this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
+ new PreventAllDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, new FilterObject("source"), false),
+ new PayEnergyCost(2)));
+
+ }
+
+ public ConsulateSurveillance(final ConsulateSurveillance card) {
+ super(card);
+ }
+
+ @Override
+ public ConsulateSurveillance copy() {
+ return new ConsulateSurveillance(this);
+ }
+}
diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageFromChosenSourceToYouEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageFromChosenSourceToYouEffect.java
new file mode 100644
index 00000000000..c8e40bd4803
--- /dev/null
+++ b/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageFromChosenSourceToYouEffect.java
@@ -0,0 +1,106 @@
+/*
+ * 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.common;
+
+import mage.abilities.Ability;
+import mage.abilities.effects.PreventionEffectImpl;
+import mage.constants.Duration;
+import mage.constants.Outcome;
+import mage.filter.FilterObject;
+import mage.game.Game;
+import mage.game.events.GameEvent;
+import mage.target.TargetSource;
+
+/**
+ *
+ * @author LevelX2
+ */
+public class PreventAllDamageFromChosenSourceToYouEffect extends PreventionEffectImpl {
+
+ protected final TargetSource targetSource;
+
+ public PreventAllDamageFromChosenSourceToYouEffect(Duration duration) {
+ this(duration, new FilterObject("source"));
+ }
+
+ public PreventAllDamageFromChosenSourceToYouEffect(Duration duration, FilterObject filter) {
+ this(duration, filter, false);
+ }
+
+ public PreventAllDamageFromChosenSourceToYouEffect(Duration duration, FilterObject filter, boolean onlyCombat) {
+ super(duration, Integer.MAX_VALUE, onlyCombat);
+ this.targetSource = new TargetSource(filter);
+ this.staticText = setText();
+ }
+
+ public PreventAllDamageFromChosenSourceToYouEffect(final PreventAllDamageFromChosenSourceToYouEffect effect) {
+ super(effect);
+ this.targetSource = effect.targetSource.copy();
+ }
+
+ @Override
+ public PreventAllDamageFromChosenSourceToYouEffect copy() {
+ return new PreventAllDamageFromChosenSourceToYouEffect(this);
+ }
+
+ @Override
+ public void init(Ability source, Game game) {
+ this.targetSource.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
+ }
+
+ @Override
+ public boolean replaceEvent(GameEvent event, Ability source, Game game) {
+ preventDamageAction(event, source, game);
+ return false;
+ }
+
+ @Override
+ public boolean applies(GameEvent event, Ability source, Game game) {
+ if (super.applies(event, source, game)) {
+ if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(targetSource.getFirstTarget())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String setText() {
+ StringBuilder sb = new StringBuilder("Prevent all ");
+ if (onlyCombat) {
+ sb.append("combat ");
+ }
+ sb.append("damage that would be dealt to you ");
+ if (duration.equals(Duration.EndOfTurn)) {
+ sb.append("this turn ");
+ }
+ sb.append("by a ").append(targetSource.getFilter().getMessage());
+ sb.append(" of your choice");
+ return sb.toString();
+ }
+
+}
diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java
index faa2598939b..1978154c16b 100644
--- a/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java
+++ b/Mage/src/main/java/mage/abilities/effects/common/counter/GetEnergyCountersControllerEffect.java
@@ -1,77 +1,77 @@
-/*
- * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of BetaSteward_at_googlemail.com.
- */
-package mage.abilities.effects.common.counter;
-
-import mage.abilities.Ability;
-import mage.abilities.effects.OneShotEffect;
-import mage.constants.Outcome;
-import mage.counters.CounterType;
-import mage.game.Game;
-import mage.players.Player;
-import mage.util.CardUtil;
-
-/**
- * @author emerald000
- */
-public class GetEnergyCountersControllerEffect extends OneShotEffect {
-
- private final int value;
-
- public GetEnergyCountersControllerEffect(int value) {
- super(Outcome.Benefit);
- this.value = value;
- setText();
- }
-
- public GetEnergyCountersControllerEffect(final GetEnergyCountersControllerEffect effect) {
- super(effect);
- this.value = effect.value;
- }
-
- @Override
- public boolean apply(Game game, Ability source) {
- Player player = game.getPlayer(source.getControllerId());
- if (player != null) {
- return player.addCounters(CounterType.ENERGY.createInstance(value), game);
- }
- return false;
- }
-
- private void setText() {
- this.staticText = "you get ";
- for (int i = 0; i < value; i++) {
- this.staticText += "{E}";
- }
- this.staticText += " (" + CardUtil.numberToText(value, "an") + " energy counter" + (value > 1 ? "s" : "") + ")";
- }
-
- @Override
- public GetEnergyCountersControllerEffect copy() {
- return new GetEnergyCountersControllerEffect(this);
- }
-}
+/*
+ * 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.common.counter;
+
+import mage.abilities.Ability;
+import mage.abilities.effects.OneShotEffect;
+import mage.constants.Outcome;
+import mage.counters.CounterType;
+import mage.game.Game;
+import mage.players.Player;
+import mage.util.CardUtil;
+
+/**
+ * @author emerald000
+ */
+public class GetEnergyCountersControllerEffect extends OneShotEffect {
+
+ private final int value;
+
+ public GetEnergyCountersControllerEffect(int value) {
+ super(Outcome.Benefit);
+ this.value = value;
+ setText();
+ }
+
+ public GetEnergyCountersControllerEffect(final GetEnergyCountersControllerEffect effect) {
+ super(effect);
+ this.value = effect.value;
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ Player player = game.getPlayer(source.getControllerId());
+ if (player != null) {
+ return player.addCounters(CounterType.ENERGY.createInstance(value), game);
+ }
+ return false;
+ }
+
+ private void setText() {
+ this.staticText = "you get ";
+ for (int i = 0; i < value; i++) {
+ this.staticText += "{E}";
+ }
+ this.staticText += " (" + CardUtil.numberToText(value, "an") + " energy counter" + (value > 1 ? "s" : "") + ").";
+ }
+
+ @Override
+ public GetEnergyCountersControllerEffect copy() {
+ return new GetEnergyCountersControllerEffect(this);
+ }
+}