From 3d5d12c418cfb565634fd51b166786b1d37f3662 Mon Sep 17 00:00:00 2001 From: emerald000 Date: Sun, 20 Jul 2014 16:07:24 -0400 Subject: [PATCH] [NEW] Added Plunge into Darkness, Favor of the Mighty, Disciple of the Vault and Arena. --- .../sets/commander2013/MagusOfTheArena.java | 66 +------ .../sets/fifthdawn/PlungeIntoDarkness.java | 182 ++++++++++++++++++ .../mage/sets/lorwyn/FavorOfTheMighty.java | 125 ++++++++++++ .../sets/mirrodin/DiscipleOfTheVault.java | 77 ++++++++ .../mirrodinbesieged/FangrenMarauder.java | 2 +- .../DiaochanArtfulBeauty.java | 65 +------ .../saviorsofkamigawa/EbonyOwlNetsuke.java | 10 +- .../src/mage/sets/timeshifted/Arena.java | 104 ++++++++++ .../common/ZoneChangeAllTriggeredAbility.java | 4 +- .../TargetOpponentsChoicePermanent.java | 78 ++++++++ 10 files changed, 585 insertions(+), 128 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java create mode 100644 Mage.Sets/src/mage/sets/lorwyn/FavorOfTheMighty.java create mode 100644 Mage.Sets/src/mage/sets/mirrodin/DiscipleOfTheVault.java create mode 100644 Mage.Sets/src/mage/sets/timeshifted/Arena.java create mode 100644 Mage/src/mage/target/common/TargetOpponentsChoicePermanent.java diff --git a/Mage.Sets/src/mage/sets/commander2013/MagusOfTheArena.java b/Mage.Sets/src/mage/sets/commander2013/MagusOfTheArena.java index a714deaff21..16a604b7b25 100644 --- a/Mage.Sets/src/mage/sets/commander2013/MagusOfTheArena.java +++ b/Mage.Sets/src/mage/sets/commander2013/MagusOfTheArena.java @@ -43,10 +43,8 @@ import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; -import mage.target.common.TargetOpponent; +import mage.target.common.TargetOpponentsChoicePermanent; /** * @@ -68,7 +66,7 @@ public class MagusOfTheArena extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MagusOfTheArenaEffect(), new GenericManaCost(3)); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetControlledCreaturePermanent()); - ability.addTarget(new TargetOpponentsChoiceControlledCreaturePermanent()); + ability.addTarget(new TargetOpponentsChoicePermanent(new FilterControlledCreaturePermanent())); this.addAbility(ability); } @@ -84,12 +82,12 @@ public class MagusOfTheArena extends CardImpl { class MagusOfTheArenaEffect extends OneShotEffect { - public MagusOfTheArenaEffect() { + MagusOfTheArenaEffect() { super(Outcome.Benefit); this.staticText = "Tap target creature you control and target creature of an opponent's choice he or she controls. Those creatures fight each other"; } - public MagusOfTheArenaEffect(final MagusOfTheArenaEffect effect) { + MagusOfTheArenaEffect(final MagusOfTheArenaEffect effect) { super(effect); } @@ -111,59 +109,3 @@ class MagusOfTheArenaEffect extends OneShotEffect { return new FightTargetsEffect().apply(game, source); } } - -class TargetOpponentsChoiceControlledCreaturePermanent extends TargetPermanent { - - private UUID opponentId = null; - - public TargetOpponentsChoiceControlledCreaturePermanent() { - super(1, 1, new FilterControlledCreaturePermanent(), false); - this.targetName = filter.getMessage(); - } - - public TargetOpponentsChoiceControlledCreaturePermanent(final TargetOpponentsChoiceControlledCreaturePermanent target) { - super(target); - this.opponentId = target.opponentId; - } - - @Override - public boolean canTarget(UUID controllerId, UUID id, UUID sourceId, Game game, boolean flag) { - if (opponentId != null) { - return super.canTarget(opponentId, id, sourceId, game, flag); - } - return false; - } - - @Override - public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) { - if (opponentId != null) { - return super.canTarget(opponentId, id, source, game); - } - return false; - } - - @Override - public boolean chooseTarget(Outcome outcome, UUID playerId, Ability source, Game game) { - return super.chooseTarget(outcome, getOpponentId(playerId, source, game), source, game); - } - - @Override - public TargetOpponentsChoiceControlledCreaturePermanent copy() { - return new TargetOpponentsChoiceControlledCreaturePermanent(this); - } - - private UUID getOpponentId(UUID playerId, Ability source, Game game) { - if (opponentId == null) { - TargetOpponent target = new TargetOpponent(); - Player player = game.getPlayer(playerId); - if (player != null) { - if (player.chooseTarget(Outcome.Detriment, target, source, game)) { - opponentId = target.getFirstTarget(); - } - } - - } - return opponentId; - } - -} diff --git a/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java b/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java new file mode 100644 index 00000000000..a2a8ccab08a --- /dev/null +++ b/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java @@ -0,0 +1,182 @@ +/* + * 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.fifthdawn; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.costs.VariableCost; +import mage.abilities.costs.common.PayVariableLifeCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.EntwineAbility; +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.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetCard; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author emerald000 + */ +public class PlungeIntoDarkness extends CardImpl { + + public PlungeIntoDarkness(UUID ownerId) { + super(ownerId, 57, "Plunge into Darkness", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{B}"); + this.expansionSetCode = "5DN"; + + this.color.setBlack(true); + + // Choose one - + this.getSpellAbility().getModes().setMinModes(1); + this.getSpellAbility().getModes().setMaxModes(1); + // Sacrifice any number of creatures, then you gain 3 life for each sacrificed creature; + this.getSpellAbility().addEffect(new PlungeIntoDarknessLifeEffect()); + // or pay X life, then look at the top X cards of your library, put one of those cards into your hand, and exile the rest. + Mode mode = new Mode(); + mode.getEffects().add(new PlungeIntoDarknessSearchEffect()); + this.getSpellAbility().getModes().addMode(mode); + + // Entwine {B} + this.addAbility(new EntwineAbility("{B}")); + } + + public PlungeIntoDarkness(final PlungeIntoDarkness card) { + super(card); + } + + @Override + public PlungeIntoDarkness copy() { + return new PlungeIntoDarkness(this); + } +} + +class PlungeIntoDarknessLifeEffect extends OneShotEffect { + + PlungeIntoDarknessLifeEffect() { + super(Outcome.GainLife); + this.staticText = "Sacrifice any number of creatures, then you gain 3 life for each sacrificed creature"; + } + + PlungeIntoDarknessLifeEffect(final PlungeIntoDarknessLifeEffect effect) { + super(effect); + } + + @Override + public PlungeIntoDarknessLifeEffect copy() { + return new PlungeIntoDarknessLifeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, new FilterControlledCreaturePermanent(), true); + player.chooseTarget(Outcome.Sacrifice, target, source, game); + int numSacrificed = 0; + for (UUID permanentId : target.getTargets()) { + Permanent permanent = game.getPermanent(permanentId); + if (permanent != null) { + if (permanent.sacrifice(source.getSourceId(), game)) { + numSacrificed++; + } + } + } + if (numSacrificed > 0) { + player.gainLife(3 * numSacrificed, game); + } + return true; + } + return false; + } +} + +class PlungeIntoDarknessSearchEffect extends OneShotEffect { + + PlungeIntoDarknessSearchEffect() { + super(Outcome.Benefit); + this.staticText = "pay X life, then look at the top X cards of your library, put one of those cards into your hand, and exile the rest."; + } + + PlungeIntoDarknessSearchEffect(final PlungeIntoDarknessSearchEffect effect) { + super(effect); + } + + @Override + public PlungeIntoDarknessSearchEffect copy() { + return new PlungeIntoDarknessSearchEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + VariableCost cost = new PayVariableLifeCost(); + int xValue = cost.announceXValue(source, game); + cost.getFixedCostsFromAnnouncedValue(xValue).pay(source, game, source.getSourceId(), source.getControllerId(), true); + + Cards cards = new CardsImpl(Zone.PICK); + int count = Math.min(player.getLibrary().size(), xValue); + for (int i = 0; i < count; i++) { + Card card = player.getLibrary().removeFromTop(game); + if (card != null) { + cards.add(card); + game.setZone(card.getId(), Zone.PICK); + } + } + player.lookAtCards("Plunge into Darkness", cards, game); + + TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put into your hand")); + if (player.choose(Outcome.DrawCard, cards, target, game)) { + Card card = cards.get(target.getFirstTarget(), game); + if (card != null) { + cards.remove(card); + card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + game.informPlayers("Plunge into Darkness: " + player.getName() + " puts a card into his or her hand"); + } + } + for (UUID cardId : cards) { + Card card = game.getCard(cardId); + card.moveToExile(null, "", source.getSourceId(), game); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/lorwyn/FavorOfTheMighty.java b/Mage.Sets/src/mage/sets/lorwyn/FavorOfTheMighty.java new file mode 100644 index 00000000000..8d0c853f31b --- /dev/null +++ b/Mage.Sets/src/mage/sets/lorwyn/FavorOfTheMighty.java @@ -0,0 +1,125 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.lorwyn; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.keyword.ProtectionAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; +import mage.filter.Filter.ComparisonType; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author emerald000 + */ +public class FavorOfTheMighty extends CardImpl { + + public FavorOfTheMighty(UUID ownerId) { + super(ownerId, 14, "Favor of the Mighty", Rarity.RARE, new CardType[]{CardType.TRIBAL, CardType.ENCHANTMENT}, "{1}{W}"); + this.expansionSetCode = "LRW"; + this.subtype.add("Giant"); + + this.color.setWhite(true); + + // Each creature with the highest converted mana cost has protection from all colors. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new FavorOfTheMightyEffect())); + } + + public FavorOfTheMighty(final FavorOfTheMighty card) { + super(card); + } + + @Override + public FavorOfTheMighty copy() { + return new FavorOfTheMighty(this); + } +} + +@SuppressWarnings("unchecked") +class FavorOfTheMightyEffect extends ContinuousEffectImpl { + + private static final FilterCard filter = new FilterCard("all colors"); + static { + filter.add(Predicates.or( + new ColorPredicate(ObjectColor.WHITE), + new ColorPredicate(ObjectColor.BLUE), + new ColorPredicate(ObjectColor.BLACK), + new ColorPredicate(ObjectColor.RED), + new ColorPredicate(ObjectColor.GREEN))); + } + + FavorOfTheMightyEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); + this.staticText = "Each creature with the highest converted mana cost has protection from all colors."; + } + + FavorOfTheMightyEffect(final FavorOfTheMightyEffect effect) { + super(effect); + } + + @Override + public FavorOfTheMightyEffect copy() { + return new FavorOfTheMightyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int maxCMC = Integer.MIN_VALUE; + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { + if (permanent != null && permanent.getManaCost().convertedManaCost() > maxCMC) { + maxCMC = permanent.getManaCost().convertedManaCost(); + } + } + FilterPermanent filterMaxCMC = new FilterCreaturePermanent(); + filterMaxCMC.add(new ConvertedManaCostPredicate(ComparisonType.Equal, maxCMC)); + for (Permanent permanent : game.getBattlefield().getActivePermanents(filterMaxCMC, source.getControllerId(), game)) { + if (permanent != null) { + permanent.addAbility(new ProtectionAbility(filter), source.getSourceId(), game); + } + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/mirrodin/DiscipleOfTheVault.java b/Mage.Sets/src/mage/sets/mirrodin/DiscipleOfTheVault.java new file mode 100644 index 00000000000..987c7821ab2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/DiscipleOfTheVault.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.mirrodin; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ZoneChangeAllTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterArtifactPermanent; +import mage.target.common.TargetOpponent; + +/** + * + * @author emerald000 + */ +public class DiscipleOfTheVault extends CardImpl { + + public DiscipleOfTheVault(UUID ownerId) { + super(ownerId, 62, "Disciple of the Vault", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{B}"); + this.expansionSetCode = "MRD"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + + this.color.setBlack(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever an artifact is put into a graveyard from the battlefield, you may have target opponent lose 1 life. + Effect effect = new LoseLifeTargetEffect(1); + effect.setText("you may have target opponent lose 1 life"); + Ability ability = new ZoneChangeAllTriggeredAbility(Zone.BATTLEFIELD, Zone.BATTLEFIELD, Zone.GRAVEYARD, + effect, new FilterArtifactPermanent(), + "Whenever an artifact is put into a graveyard from the battlefield, ", true); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + } + + public DiscipleOfTheVault(final DiscipleOfTheVault card) { + super(card); + } + + @Override + public DiscipleOfTheVault copy() { + return new DiscipleOfTheVault(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/FangrenMarauder.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/FangrenMarauder.java index 92bba4c8bea..330751aec62 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/FangrenMarauder.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/FangrenMarauder.java @@ -55,7 +55,7 @@ public class FangrenMarauder extends CardImpl { // Whenever an artifact is put into a graveyard from the battlefield, you may gain 5 life. this.addAbility(new ZoneChangeAllTriggeredAbility(Zone.BATTLEFIELD, Zone.BATTLEFIELD, Zone.GRAVEYARD, new GainLifeEffect(5), new FilterArtifactPermanent(), - "Whenever an enchantment is put into a graveyard from the battlefield, ", true)); + "Whenever an artifact is put into a graveyard from the battlefield, ", true)); } public FangrenMarauder(final FangrenMarauder card) { diff --git a/Mage.Sets/src/mage/sets/portalthreekingdoms/DiaochanArtfulBeauty.java b/Mage.Sets/src/mage/sets/portalthreekingdoms/DiaochanArtfulBeauty.java index 188980c978c..11fb377ba85 100644 --- a/Mage.Sets/src/mage/sets/portalthreekingdoms/DiaochanArtfulBeauty.java +++ b/Mage.Sets/src/mage/sets/portalthreekingdoms/DiaochanArtfulBeauty.java @@ -43,9 +43,8 @@ import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; -import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; -import mage.target.common.TargetOpponent; +import mage.target.common.TargetOpponentsChoicePermanent; /** * @@ -67,7 +66,7 @@ public class DiaochanArtfulBeauty extends CardImpl { // {tap}: Destroy target creature of your choice, then destroy target creature of an opponent's choice. Activate this ability only during your turn, before attackers are declared. Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DiaochanArtfulBeautyDestroyEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance()); ability.addTarget(new TargetCreaturePermanent()); - ability.addTarget(new TargetOpponentsChoiceCreaturePermanent()); + ability.addTarget(new TargetOpponentsChoicePermanent(new FilterCreaturePermanent())); this.addAbility(ability); } @@ -83,12 +82,12 @@ public class DiaochanArtfulBeauty extends CardImpl { class DiaochanArtfulBeautyDestroyEffect extends OneShotEffect { - public DiaochanArtfulBeautyDestroyEffect() { + DiaochanArtfulBeautyDestroyEffect() { super(Outcome.DestroyPermanent); this.staticText = "Destroy target creature of your choice, then destroy target creature of an opponent's choice"; } - public DiaochanArtfulBeautyDestroyEffect(final DiaochanArtfulBeautyDestroyEffect effect) { + DiaochanArtfulBeautyDestroyEffect(final DiaochanArtfulBeautyDestroyEffect effect) { super(effect); } @@ -115,59 +114,3 @@ class DiaochanArtfulBeautyDestroyEffect extends OneShotEffect { return false; } } - -class TargetOpponentsChoiceCreaturePermanent extends TargetPermanent { - - private UUID opponentId = null; - - public TargetOpponentsChoiceCreaturePermanent() { - super(1, 1, new FilterCreaturePermanent(), false); - this.targetName = filter.getMessage(); - } - - public TargetOpponentsChoiceCreaturePermanent(final TargetOpponentsChoiceCreaturePermanent target) { - super(target); - this.opponentId = target.opponentId; - } - - @Override - public boolean canTarget(UUID controllerId, UUID id, UUID sourceId, Game game, boolean flag) { - if (opponentId != null) { - return super.canTarget(opponentId, id, sourceId, game, flag); - } - return false; - } - - @Override - public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) { - if (opponentId != null) { - return super.canTarget(opponentId, id, source, game); - } - return false; - } - - @Override - public boolean chooseTarget(Outcome outcome, UUID playerId, Ability source, Game game) { - return super.chooseTarget(outcome, getOpponentId(playerId, source, game), source, game); - } - - @Override - public TargetOpponentsChoiceCreaturePermanent copy() { - return new TargetOpponentsChoiceCreaturePermanent(this); - } - - private UUID getOpponentId(UUID playerId, Ability source, Game game) { - if (opponentId == null) { - TargetOpponent target = new TargetOpponent(); - Player player = game.getPlayer(playerId); - if (player != null) { - if (player.chooseTarget(Outcome.Detriment, target, source, game)) { - opponentId = target.getFirstTarget(); - } - } - - } - return opponentId; - } - -} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/EbonyOwlNetsuke.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/EbonyOwlNetsuke.java index 493051e084e..a06dd8efcd5 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/EbonyOwlNetsuke.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/EbonyOwlNetsuke.java @@ -84,7 +84,7 @@ class EbonyOwlNetsukeTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && game.getOpponents(controllerId).contains(event.getPlayerId())) { Player player = game.getPlayer(event.getPlayerId()); - if (player != null && player.getHand().size() >= 7) { + if (player != null) { EbonyOwlNetsukeEffect effect = new EbonyOwlNetsukeEffect(); effect.setTargetPointer(new FixedTarget(player.getId())); this.addEffect(effect); @@ -94,6 +94,12 @@ class EbonyOwlNetsukeTriggeredAbility extends TriggeredAbilityImpl { return false; } + @Override + public boolean checkInterveningIfClause(Game game) { + Player player = game.getPlayer(game.getActivePlayerId()); + return player != null && player.getHand().size() >= 7; + } + @Override public String getRule() { return "At the beginning of each opponent's upkeep, if that player has seven or more cards in hand, {this} deals 4 damage to him or her."; @@ -119,7 +125,7 @@ class EbonyOwlNetsukeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null && player.getHand().size() >= 7) { + if (player != null) { player.damage(4, source.getSourceId(), game, false, true); return true; } diff --git a/Mage.Sets/src/mage/sets/timeshifted/Arena.java b/Mage.Sets/src/mage/sets/timeshifted/Arena.java new file mode 100644 index 00000000000..ce484ccc96f --- /dev/null +++ b/Mage.Sets/src/mage/sets/timeshifted/Arena.java @@ -0,0 +1,104 @@ +/* + * 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.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.FightTargetsEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetOpponentsChoicePermanent; + +/** + * + * @author emerald000 + */ +public class Arena extends CardImpl { + + public Arena(UUID ownerId) { + super(ownerId, 117, "Arena", Rarity.SPECIAL, new CardType[]{CardType.LAND}, ""); + this.expansionSetCode = "TSB"; + + // {3}, {tap}: Tap target creature you control and target creature of an opponent's choice he or she controls. Those creatures fight each other. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ArenaEffect(), new GenericManaCost(3)); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetControlledCreaturePermanent()); + ability.addTarget(new TargetOpponentsChoicePermanent(new FilterControlledCreaturePermanent())); + this.addAbility(ability); + } + + public Arena(final Arena card) { + super(card); + } + + @Override + public Arena copy() { + return new Arena(this); + } +} + +class ArenaEffect extends OneShotEffect { + + ArenaEffect() { + super(Outcome.Benefit); + this.staticText = "Tap target creature you control and target creature of an opponent's choice he or she controls. Those creatures fight each other."; + } + + ArenaEffect(final ArenaEffect effect) { + super(effect); + } + + @Override + public ArenaEffect copy() { + return new ArenaEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent creature = game.getPermanent(source.getFirstTarget()); + if (creature != null) { + creature.tap(game); + } + creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); + if (creature != null) { + creature.tap(game); + } + return new FightTargetsEffect().apply(game, source); + } +} diff --git a/Mage/src/mage/abilities/common/ZoneChangeAllTriggeredAbility.java b/Mage/src/mage/abilities/common/ZoneChangeAllTriggeredAbility.java index d393441dfac..2615f5e6423 100644 --- a/Mage/src/mage/abilities/common/ZoneChangeAllTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/ZoneChangeAllTriggeredAbility.java @@ -28,9 +28,9 @@ package mage.abilities.common; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; +import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.events.GameEvent; @@ -50,7 +50,7 @@ public class ZoneChangeAllTriggeredAbility extends TriggeredAbilityImpl { protected Zone toZone; protected String rule; - public ZoneChangeAllTriggeredAbility(Zone zone, Zone toZone, Effect effect, FilterPermanent filter,String rule, boolean optional) { + public ZoneChangeAllTriggeredAbility(Zone zone, Zone toZone, Effect effect, FilterPermanent filter, String rule, boolean optional) { this(zone, null, toZone, effect, filter, rule, optional); } diff --git a/Mage/src/mage/target/common/TargetOpponentsChoicePermanent.java b/Mage/src/mage/target/common/TargetOpponentsChoicePermanent.java new file mode 100644 index 00000000000..80eb4bef744 --- /dev/null +++ b/Mage/src/mage/target/common/TargetOpponentsChoicePermanent.java @@ -0,0 +1,78 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package mage.target.common; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.constants.Outcome; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPermanent; + +/** + * + * @author Mael + */ +public class TargetOpponentsChoicePermanent extends TargetPermanent { + + protected UUID opponentId = null; + + public TargetOpponentsChoicePermanent(FilterPermanent filter) { + super(1, 1, filter, false); + this.targetName = filter.getMessage(); + } + + public TargetOpponentsChoicePermanent(int minNumTargets, int maxNumTargets, FilterPermanent filter, boolean notTarget) { + super(minNumTargets, maxNumTargets, filter, notTarget); + this.targetName = filter.getMessage(); + } + + public TargetOpponentsChoicePermanent(final TargetOpponentsChoicePermanent target) { + super(target); + this.opponentId = target.opponentId; + } + + @Override + public boolean canTarget(UUID controllerId, UUID id, UUID sourceId, Game game, boolean flag) { + if (opponentId != null) { + return super.canTarget(opponentId, id, sourceId, game, flag); + } + return false; + } + + @Override + public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) { + if (opponentId != null) { + return super.canTarget(opponentId, id, source, game); + } + return false; + } + + @Override + public boolean chooseTarget(Outcome outcome, UUID playerId, Ability source, Game game) { + return super.chooseTarget(outcome, getOpponentId(playerId, source, game), source, game); + } + + @Override + public TargetOpponentsChoicePermanent copy() { + return new TargetOpponentsChoicePermanent(this); + } + + private UUID getOpponentId(UUID playerId, Ability source, Game game) { + if (opponentId == null) { + TargetOpponent target = new TargetOpponent(); + Player player = game.getPlayer(playerId); + if (player != null) { + if (player.chooseTarget(Outcome.Detriment, target, source, game)) { + opponentId = target.getFirstTarget(); + } + } + } + return opponentId; + } +}