From c6745098437f0cef558c074a84cd70e4f2d192d5 Mon Sep 17 00:00:00 2001 From: emerald000 Date: Thu, 30 Oct 2014 22:24:20 -0400 Subject: [PATCH] Added Delaying Shield, Oath of Lieges, Paradox Haze and Sacred Mesa. --- .../src/mage/sets/exodus/OathOfLieges.java | 123 ++++++++++++++ .../src/mage/sets/mirage/SacredMesa.java | 94 +++++++++++ .../src/mage/sets/odyssey/DelayingShield.java | 154 ++++++++++++++++++ .../src/mage/sets/timeshifted/SacredMesa.java | 54 ++++++ .../src/mage/sets/timespiral/ParadoxHaze.java | 143 ++++++++++++++++ Mage/src/mage/counters/CounterType.java | 1 + 6 files changed, 569 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/exodus/OathOfLieges.java create mode 100644 Mage.Sets/src/mage/sets/mirage/SacredMesa.java create mode 100644 Mage.Sets/src/mage/sets/odyssey/DelayingShield.java create mode 100644 Mage.Sets/src/mage/sets/timeshifted/SacredMesa.java create mode 100644 Mage.Sets/src/mage/sets/timespiral/ParadoxHaze.java diff --git a/Mage.Sets/src/mage/sets/exodus/OathOfLieges.java b/Mage.Sets/src/mage/sets/exodus/OathOfLieges.java new file mode 100644 index 00000000000..631793810c0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/exodus/OathOfLieges.java @@ -0,0 +1,123 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.exodus; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.FilterPlayer; +import mage.filter.common.FilterBasicLandCard; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author emerald000 + */ +public class OathOfLieges extends CardImpl { + + private static final FilterPlayer filter = new FilterPlayer(); + static { + filter.add(new OathOfLiegesPredicate()); + } + + public OathOfLieges(UUID ownerId) { + super(ownerId, 11, "Oath of Lieges", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); + this.expansionSetCode = "EXO"; + + this.color.setWhite(true); + + // At the beginning of each player's upkeep, that player chooses target player who controls more lands than he or she does and is his or her opponent. The first player may search his or her library for a basic land card, put that card onto the battlefield, then shuffle his or her library. + Effect effect = new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterBasicLandCard()), false, Outcome.PutLandInPlay); + effect.setText("that player chooses target player who controls more lands than he or she does and is his or her opponent. The first player may search his or her library for a basic land card, put that card onto the battlefield, then shuffle his or her library"); + Ability ability = new BeginningOfUpkeepTriggeredAbility(effect, TargetController.ANY, true); + ability.addTarget(new TargetPlayer(1, 1, false, filter)); + this.addAbility(ability); + } + + public OathOfLieges(final OathOfLieges card) { + super(card); + } + + @Override + public void adjustTargets(Ability ability, Game game) { + if (ability instanceof BeginningOfUpkeepTriggeredAbility) { + Player activePlayer = game.getPlayer(game.getActivePlayerId()); + if (activePlayer != null) { + ability.setControllerId(activePlayer.getId()); + ability.getTargets().clear(); + TargetPlayer target = new TargetPlayer(1, 1, false, filter); + ability.getTargets().add(target); + } + } + } + + @Override + public OathOfLieges copy() { + return new OathOfLieges(this); + } +} + +class OathOfLiegesPredicate implements ObjectSourcePlayerPredicate> { + + private static final FilterLandPermanent filter = new FilterLandPermanent(); + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + Player targetPlayer = input.getObject(); + //Get active input.playerId because adjust target is used after canTarget function + UUID activePlayerId = game.getActivePlayerId(); + if (targetPlayer == null || activePlayerId == null) { + return false; + } + if (targetPlayer.getId().equals(activePlayerId)) { + return false; + } + int countTargetPlayer = game.getBattlefield().countAll(filter, targetPlayer.getId(), game); + int countActivePlayer = game.getBattlefield().countAll(filter, activePlayerId, game); + + return countTargetPlayer > countActivePlayer; + } + + @Override + public String toString() { + return "player who controls more lands than he or she does and is his or her opponent"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/mirage/SacredMesa.java b/Mage.Sets/src/mage/sets/mirage/SacredMesa.java new file mode 100644 index 00000000000..9ff98ab9047 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/SacredMesa.java @@ -0,0 +1,94 @@ +/* + * 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.mirage; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.permanent.token.Token; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author emerald000 + */ +public class SacredMesa extends CardImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent("Pegasus"); + static { + filter.add(new SubtypePredicate("a Pegasus")); + } + + public SacredMesa(UUID ownerId) { + super(ownerId, 241, "Sacred Mesa", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); + this.expansionSetCode = "MIR"; + + this.color.setWhite(true); + + // At the beginning of your upkeep, sacrifice Sacred Mesa unless you sacrifice a Pegasus. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new SacrificeTargetCost(new TargetControlledPermanent(filter))), TargetController.YOU, false)); + + // {1}{W}: Put a 1/1 white Pegasus creature token with flying onto the battlefield. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SacredMesaPegasusToken()), new ManaCostsImpl<>("{1}{W}"))); + } + + public SacredMesa(final SacredMesa card) { + super(card); + } + + @Override + public SacredMesa copy() { + return new SacredMesa(this); + } +} + +class SacredMesaPegasusToken extends Token { + + SacredMesaPegasusToken() { + super("Pegasus", "1/1 white Pegasus creature token with flying"); + cardType.add(CardType.CREATURE); + color.setWhite(true); + subtype.add("Pegasus"); + power = new MageInt(1); + toughness = new MageInt(1); + addAbility(FlyingAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java b/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java new file mode 100644 index 00000000000..25a8e6037bb --- /dev/null +++ b/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java @@ -0,0 +1,154 @@ +/* + * 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.odyssey; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.DamageEvent; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author emerald000 + */ +public class DelayingShield extends CardImpl { + + public DelayingShield(UUID ownerId) { + super(ownerId, 17, "Delaying Shield", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}"); + this.expansionSetCode = "ODY"; + + this.color.setWhite(true); + + // If damage would be dealt to you, put that many delay counters on Delaying Shield instead. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DelayingShieldReplacementEffect())); + + // At the beginning of your upkeep, remove all delay counters from Delaying Shield. For each delay counter removed this way, you lose 1 life unless you pay {1}{W}. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DelayingShieldUpkeepEffect(), TargetController.YOU, false)); + } + + public DelayingShield(final DelayingShield card) { + super(card); + } + + @Override + public DelayingShield copy() { + return new DelayingShield(this); + } +} + +class DelayingShieldReplacementEffect extends ReplacementEffectImpl { + + DelayingShieldReplacementEffect() { + super(Duration.WhileOnBattlefield, Outcome.PreventDamage); + staticText = "If damage would be dealt to you, put that many delay counters on {this} instead"; + } + + DelayingShieldReplacementEffect(final DelayingShieldReplacementEffect effect) { + super(effect); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + DamageEvent damageEvent = (DamageEvent) event; + new AddCountersSourceEffect(CounterType.DELAY.createInstance(damageEvent.getAmount())).apply(game, source); + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return event.getType() == EventType.DAMAGE_PLAYER && event.getTargetId().equals(source.getControllerId()); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public DelayingShieldReplacementEffect copy() { + return new DelayingShieldReplacementEffect(this); + } +} + +class DelayingShieldUpkeepEffect extends OneShotEffect { + + DelayingShieldUpkeepEffect() { + super(Outcome.Benefit); + this.staticText = "remove all delay counters from {this}. For each delay counter removed this way, you lose 1 life unless you pay {1}{W}"; + } + + DelayingShieldUpkeepEffect(final DelayingShieldUpkeepEffect effect) { + super(effect); + } + + @Override + public DelayingShieldUpkeepEffect copy() { + return new DelayingShieldUpkeepEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (player != null && permanent != null) { + int numCounters = permanent.getCounters().getCount(CounterType.DELAY); + permanent.removeCounters(CounterType.DELAY.createInstance(), game); + for (int i = numCounters; i > 0; i--) { + if (player.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", game)) { + Cost cost = new ManaCostsImpl<>("{1}{W}"); + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + continue; + } + } + new LoseLifeSourceControllerEffect(1).apply(game, source); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/timeshifted/SacredMesa.java b/Mage.Sets/src/mage/sets/timeshifted/SacredMesa.java new file mode 100644 index 00000000000..142b55e24be --- /dev/null +++ b/Mage.Sets/src/mage/sets/timeshifted/SacredMesa.java @@ -0,0 +1,54 @@ +/* + * 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.timeshifted; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author emerald000 + */ +public class SacredMesa extends mage.sets.mirage.SacredMesa { + + public SacredMesa(UUID ownerId) { + super(ownerId); + this.cardNumber = 13; + this.expansionSetCode = "TSB"; + this.rarity = Rarity.SPECIAL; + } + + public SacredMesa(final SacredMesa card) { + super(card); + } + + @Override + public SacredMesa copy() { + return new SacredMesa(this); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/ParadoxHaze.java b/Mage.Sets/src/mage/sets/timespiral/ParadoxHaze.java new file mode 100644 index 00000000000..ad9ca4ccb4f --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/ParadoxHaze.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.sets.timespiral; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.turn.TurnMod; +import mage.game.turn.UpkeepStep; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author emerald000 + */ +public class ParadoxHaze extends CardImpl { + + public ParadoxHaze(UUID ownerId) { + super(ownerId, 71, "Paradox Haze", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); + this.expansionSetCode = "TSP"; + this.subtype.add("Aura"); + + this.color.setBlue(true); + + // Enchant player + TargetPlayer auraTarget = new TargetPlayer(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Neutral)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // At the beginning of enchanted player's first upkeep each turn, that player gets an additional upkeep step after this step. + this.addAbility(new ParadoxHazeTriggeredAbility()); + } + + public ParadoxHaze(final ParadoxHaze card) { + super(card); + } + + @Override + public ParadoxHaze copy() { + return new ParadoxHaze(this); + } +} + +class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl { + + int lastTriggerTurnNumber; + + ParadoxHazeTriggeredAbility() { + super(Zone.BATTLEFIELD, new ParadoxHazeEffect(), false); + } + + ParadoxHazeTriggeredAbility(final ParadoxHazeTriggeredAbility ability) { + super(ability); + } + + @Override + public ParadoxHazeTriggeredAbility copy() { + return new ParadoxHazeTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { + Permanent permanent = game.getPermanent(this.sourceId); + if (permanent != null) { + Player player = game.getPlayer(permanent.getAttachedTo()); + if (player != null && game.getActivePlayerId().equals(player.getId()) && lastTriggerTurnNumber != game.getTurnNum()) { + lastTriggerTurnNumber = game.getTurnNum(); + this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); + return true; + } + } + } + return false; + } + + @Override + public String getRule() { + return "At the beginning of enchanted player's first upkeep each turn, that player gets an additional upkeep step after this step."; + } +} + +class ParadoxHazeEffect extends OneShotEffect { + + ParadoxHazeEffect() { + super(Outcome.Benefit); + this.staticText = "that player gets an additional upkeep step after this step"; + } + + ParadoxHazeEffect(final ParadoxHazeEffect effect) { + super(effect); + } + + @Override + public ParadoxHazeEffect copy() { + return new ParadoxHazeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + game.getState().getTurnMods().add(new TurnMod(this.getTargetPointer().getFirst(game, source), new UpkeepStep(), null)); + return true; + } +} diff --git a/Mage/src/mage/counters/CounterType.java b/Mage/src/mage/counters/CounterType.java index bd00f68c33f..e253c129358 100644 --- a/Mage/src/mage/counters/CounterType.java +++ b/Mage/src/mage/counters/CounterType.java @@ -41,6 +41,7 @@ public enum CounterType { BLAZE("Blaze"), BRIBERY("Bribery"), CHARGE("Charge"), + DELAY("Delay"), DEPLETION("Depletion"), DESPAIR("Despair"), DEVOTION("Devotion"),