From b753654384321f06e5de5932141585763c306393 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 25 May 2015 15:50:50 +0200 Subject: [PATCH] * Added Arcbound Crasher, Mana Clash, Tel-Jilad Stylus, Chance Encounter and Vampiric Link. --- .../mage/sets/darksteel/ArcboundCrusher.java | 52 +++++++++ .../mage/sets/eighthedition/ManaClash.java | 52 +++++++++ .../src/mage/sets/fifthedition/ManaClash.java | 52 +++++++++ .../mage/sets/fourthedition/ManaClash.java | 108 ++++++++++++++++++ .../src/mage/sets/mirrodin/KrarksThumb.java | 17 ++- .../mage/sets/mirrodin/TelJiladStylus.java | 67 +++++++++++ .../src/mage/sets/ninthedition/ManaClash.java | 52 +++++++++ .../mage/sets/odyssey/ChanceEncounter.java | 105 +++++++++++++++++ .../mage/sets/planarchaos/VampiricLink.java | 75 ++++++++++++ .../mage/sets/planechase/ArcboundCrusher.java | 82 +++++++++++++ .../sets/scarsofmirrodin/GlintHawkIdol.java | 1 + .../mage/sets/seventhedition/ManaClash.java | 52 +++++++++ .../src/mage/sets/thedark/ManaClash.java | 52 +++++++++ .../common/PutOnLibraryTargetEffect.java | 34 +++--- Mage/src/mage/game/events/GameEvent.java | 2 +- Mage/src/mage/players/PlayerImpl.java | 8 +- 16 files changed, 784 insertions(+), 27 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/darksteel/ArcboundCrusher.java create mode 100644 Mage.Sets/src/mage/sets/eighthedition/ManaClash.java create mode 100644 Mage.Sets/src/mage/sets/fifthedition/ManaClash.java create mode 100644 Mage.Sets/src/mage/sets/fourthedition/ManaClash.java create mode 100644 Mage.Sets/src/mage/sets/mirrodin/TelJiladStylus.java create mode 100644 Mage.Sets/src/mage/sets/ninthedition/ManaClash.java create mode 100644 Mage.Sets/src/mage/sets/odyssey/ChanceEncounter.java create mode 100644 Mage.Sets/src/mage/sets/planarchaos/VampiricLink.java create mode 100644 Mage.Sets/src/mage/sets/planechase/ArcboundCrusher.java create mode 100644 Mage.Sets/src/mage/sets/seventhedition/ManaClash.java create mode 100644 Mage.Sets/src/mage/sets/thedark/ManaClash.java diff --git a/Mage.Sets/src/mage/sets/darksteel/ArcboundCrusher.java b/Mage.Sets/src/mage/sets/darksteel/ArcboundCrusher.java new file mode 100644 index 0000000000..83f267ab0c --- /dev/null +++ b/Mage.Sets/src/mage/sets/darksteel/ArcboundCrusher.java @@ -0,0 +1,52 @@ +/* + * 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.darksteel; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class ArcboundCrusher extends mage.sets.planechase.ArcboundCrusher { + + public ArcboundCrusher(UUID ownerId) { + super(ownerId); + this.cardNumber = 95; + this.expansionSetCode = "DST"; + } + + public ArcboundCrusher(final ArcboundCrusher card) { + super(card); + } + + @Override + public ArcboundCrusher copy() { + return new ArcboundCrusher(this); + } +} diff --git a/Mage.Sets/src/mage/sets/eighthedition/ManaClash.java b/Mage.Sets/src/mage/sets/eighthedition/ManaClash.java new file mode 100644 index 0000000000..232905b94f --- /dev/null +++ b/Mage.Sets/src/mage/sets/eighthedition/ManaClash.java @@ -0,0 +1,52 @@ +/* + * 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.eighthedition; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class ManaClash extends mage.sets.fourthedition.ManaClash { + + public ManaClash(UUID ownerId) { + super(ownerId); + this.cardNumber = 202; + this.expansionSetCode = "8ED"; + } + + public ManaClash(final ManaClash card) { + super(card); + } + + @Override + public ManaClash copy() { + return new ManaClash(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fifthedition/ManaClash.java b/Mage.Sets/src/mage/sets/fifthedition/ManaClash.java new file mode 100644 index 0000000000..3dac56f688 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fifthedition/ManaClash.java @@ -0,0 +1,52 @@ +/* + * 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.fifthedition; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class ManaClash extends mage.sets.fourthedition.ManaClash { + + public ManaClash(UUID ownerId) { + super(ownerId); + this.cardNumber = 248; + this.expansionSetCode = "5ED"; + } + + public ManaClash(final ManaClash card) { + super(card); + } + + @Override + public ManaClash copy() { + return new ManaClash(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fourthedition/ManaClash.java b/Mage.Sets/src/mage/sets/fourthedition/ManaClash.java new file mode 100644 index 0000000000..3af5080683 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fourthedition/ManaClash.java @@ -0,0 +1,108 @@ +/* + * 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.fourthedition; + +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.game.Game; +import mage.players.Player; +import mage.target.common.TargetOpponent; + +/** + * + * @author LevelX2 + */ +public class ManaClash extends CardImpl { + + public ManaClash(UUID ownerId) { + super(ownerId, 228, "Mana Clash", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{R}"); + this.expansionSetCode = "4ED"; + + // You and target opponent each flip a coin. Mana Clash deals 1 damage to each player whose coin comes up tails. Repeat this process until both players' coins come up heads on the same flip. + this.getSpellAbility().addEffect(new ManaClashEffect()); + this.getSpellAbility().addTarget(new TargetOpponent()); + } + + public ManaClash(final ManaClash card) { + super(card); + } + + @Override + public ManaClash copy() { + return new ManaClash(this); + } +} + +class ManaClashEffect extends OneShotEffect { + + public ManaClashEffect() { + super(Outcome.Detriment); + this.staticText = "You and target opponent each flip a coin. {this} deals 1 damage to each player whose coin comes up tails. Repeat this process until both players' coins come up heads on the same flip"; + } + + public ManaClashEffect(final ManaClashEffect effect) { + super(effect); + } + + @Override + public ManaClashEffect copy() { + return new ManaClashEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (controller != null && targetOpponent != null) { + boolean bothHeads = false; + while (!bothHeads) { + if (!targetOpponent.isInGame() || !controller.isInGame()) { + return false; + } + boolean controllerFlip = controller.flipCoin(game); + boolean opponentFlip = targetOpponent.flipCoin(game); + if (controllerFlip && opponentFlip) { + bothHeads = true; + } + if (!controllerFlip) { + controller.damage(1, source.getSourceId(), game, false, true); + } + if (!opponentFlip) { + targetOpponent.damage(1, source.getSourceId(), game, false, true); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/mirrodin/KrarksThumb.java b/Mage.Sets/src/mage/sets/mirrodin/KrarksThumb.java index efd82bfd8e..fda4d43fcc 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/KrarksThumb.java +++ b/Mage.Sets/src/mage/sets/mirrodin/KrarksThumb.java @@ -27,6 +27,7 @@ */ package mage.sets.mirrodin; +import java.util.Random; import java.util.UUID; import mage.constants.CardType; import mage.constants.Duration; @@ -80,7 +81,11 @@ class KrarksThumbEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); if (player != null) { - boolean secondCoinFlip = player.flipCoin(game, event.getAppliedEffects()); + // because second flip is ignored it may not be done by the player method + boolean secondCoinFlip = new Random().nextBoolean(); + if (!game.isSimulation()) { + game.informPlayers("[Flip a coin] " + player.getLogName() + (secondCoinFlip ? " won (head)." : " lost (tail).")); + } if (player.chooseUse(outcome, "Ignore the first coin flip?", game)) { event.setFlag(secondCoinFlip); game.informPlayers(new StringBuilder(player.getLogName()).append(" ignores the first coin flip.").toString()); @@ -91,12 +96,14 @@ class KrarksThumbEffect extends ReplacementEffectImpl { return false; } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.FLIP_COIN; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.FLIP_COIN && source.getControllerId().equals(event.getPlayerId())) { - return true; - } - return false; + return source.getControllerId().equals(event.getPlayerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/mirrodin/TelJiladStylus.java b/Mage.Sets/src/mage/sets/mirrodin/TelJiladStylus.java new file mode 100644 index 0000000000..56f529fa89 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/TelJiladStylus.java @@ -0,0 +1,67 @@ +/* + * 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.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.PutOnLibraryTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author LevelX2 + */ +public class TelJiladStylus extends CardImpl { + + public TelJiladStylus(UUID ownerId) { + super(ownerId, 260, "Tel-Jilad Stylus", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{1}"); + this.expansionSetCode = "MRD"; + + // {T}: Put target permanent you own on the bottom of your library. + Effect effect = new PutOnLibraryTargetEffect(false,"put target permanent you own on the bottom of your library"); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost()); + ability.addTarget(new TargetControlledPermanent()); + this.addAbility(ability); + } + + public TelJiladStylus(final TelJiladStylus card) { + super(card); + } + + @Override + public TelJiladStylus copy() { + return new TelJiladStylus(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ninthedition/ManaClash.java b/Mage.Sets/src/mage/sets/ninthedition/ManaClash.java new file mode 100644 index 0000000000..cfc678f1fd --- /dev/null +++ b/Mage.Sets/src/mage/sets/ninthedition/ManaClash.java @@ -0,0 +1,52 @@ +/* + * 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.ninthedition; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class ManaClash extends mage.sets.fourthedition.ManaClash { + + public ManaClash(UUID ownerId) { + super(ownerId); + this.cardNumber = 203; + this.expansionSetCode = "9ED"; + } + + public ManaClash(final ManaClash card) { + super(card); + } + + @Override + public ManaClash copy() { + return new ManaClash(this); + } +} diff --git a/Mage.Sets/src/mage/sets/odyssey/ChanceEncounter.java b/Mage.Sets/src/mage/sets/odyssey/ChanceEncounter.java new file mode 100644 index 0000000000..d93d7c6b4b --- /dev/null +++ b/Mage.Sets/src/mage/sets/odyssey/ChanceEncounter.java @@ -0,0 +1,105 @@ +/* + * 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.TriggeredAbility; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.common.SourceHasCounterCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.WinGameSourceControllerEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author LevelX2 + */ +public class ChanceEncounter extends CardImpl { + + public ChanceEncounter(UUID ownerId) { + super(ownerId, 182, "Chance Encounter", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{R}"); + this.expansionSetCode = "ODY"; + + // Whenever you win a coin flip, put a luck counter on Chance Encounter. + this.addAbility(new ChanceEncounterTriggeredAbility()); + + // At the beginning of your upkeep, if Chance Encounter has ten or more luck counters on it, you win the game. + TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new WinGameSourceControllerEffect(), TargetController.YOU, false); + this.addAbility(new ConditionalTriggeredAbility(ability, new SourceHasCounterCondition(CounterType.LUCK, 10, Integer.MAX_VALUE), + "At the beginning of your upkeep, if {this} has ten or more luck counters on it, you win the game")); + } + + public ChanceEncounter(final ChanceEncounter card) { + super(card); + } + + @Override + public ChanceEncounter copy() { + return new ChanceEncounter(this); + } +} + +class ChanceEncounterTriggeredAbility extends TriggeredAbilityImpl { + + public ChanceEncounterTriggeredAbility() { + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.LUCK.createInstance()), false); + } + + public ChanceEncounterTriggeredAbility(final ChanceEncounterTriggeredAbility ability) { + super(ability); + } + + @Override + public ChanceEncounterTriggeredAbility copy() { + return new ChanceEncounterTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.COIN_FLIPPED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return this.getControllerId().equals(event.getPlayerId()) && event.getFlag(); + } + + @Override + public String getRule() { + return "Whenever you win a coin flip, " + super.getRule(); + } +} diff --git a/Mage.Sets/src/mage/sets/planarchaos/VampiricLink.java b/Mage.Sets/src/mage/sets/planarchaos/VampiricLink.java new file mode 100644 index 0000000000..1cdd62a59f --- /dev/null +++ b/Mage.Sets/src/mage/sets/planarchaos/VampiricLink.java @@ -0,0 +1,75 @@ +/* + * 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.planarchaos; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.DealsDamageAttachedTriggeredAbility; +import mage.abilities.dynamicvalue.common.NumericSetToEffectValues; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.GainLifeEffect; +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.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class VampiricLink extends CardImpl { + + public VampiricLink(UUID ownerId) { + super(ownerId, 92, "Vampiric Link", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{B}"); + this.expansionSetCode = "PLC"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Whenever enchanted creature deals damage, you gain that much life. + this.addAbility(new DealsDamageAttachedTriggeredAbility(Zone.BATTLEFIELD, new GainLifeEffect(new NumericSetToEffectValues("that much", "damage")), false)); + } + + public VampiricLink(final VampiricLink card) { + super(card); + } + + @Override + public VampiricLink copy() { + return new VampiricLink(this); + } +} diff --git a/Mage.Sets/src/mage/sets/planechase/ArcboundCrusher.java b/Mage.Sets/src/mage/sets/planechase/ArcboundCrusher.java new file mode 100644 index 0000000000..c616edcfcf --- /dev/null +++ b/Mage.Sets/src/mage/sets/planechase/ArcboundCrusher.java @@ -0,0 +1,82 @@ +/* + * 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.planechase; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.ModularAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterArtifactPermanent; +import mage.filter.predicate.permanent.AnotherPredicate; + +/** + * + * @author LevelX2 + */ +public class ArcboundCrusher extends CardImpl { + + private static final FilterPermanent filter = new FilterArtifactPermanent("another artifact"); + + static { + filter.add(new AnotherPredicate()); + } + + public ArcboundCrusher(UUID ownerId) { + super(ownerId, 105, "Arcbound Crusher", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); + this.expansionSetCode = "HOP"; + this.subtype.add("Juggernaut"); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever another artifact enters the battlefield, put a +1/+1 counter on Arcbound Crusher. + this.addAbility(new EntersBattlefieldAllTriggeredAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance()), filter)); + + // Modular 1 + this.addAbility(new ModularAbility(this, 1)); + } + + public ArcboundCrusher(final ArcboundCrusher card) { + super(card); + } + + @Override + public ArcboundCrusher copy() { + return new ArcboundCrusher(this); + } +} diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/GlintHawkIdol.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/GlintHawkIdol.java index 6c912c4529..036480edf6 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/GlintHawkIdol.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/GlintHawkIdol.java @@ -69,6 +69,7 @@ public class GlintHawkIdol extends CardImpl { this.addAbility(new EntersBattlefieldControlledTriggeredAbility( Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new GlintHawkIdolToken(), "", Duration.EndOfTurn), filter, true)); + // {W}: Glint Hawk Idol becomes a 2/2 Bird artifact creature with flying until end of turn. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new GlintHawkIdolToken(), "", Duration.EndOfTurn), new ColoredManaCost(ColoredManaSymbol.W))); } diff --git a/Mage.Sets/src/mage/sets/seventhedition/ManaClash.java b/Mage.Sets/src/mage/sets/seventhedition/ManaClash.java new file mode 100644 index 0000000000..05e2cb5897 --- /dev/null +++ b/Mage.Sets/src/mage/sets/seventhedition/ManaClash.java @@ -0,0 +1,52 @@ +/* + * 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.seventhedition; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class ManaClash extends mage.sets.fourthedition.ManaClash { + + public ManaClash(UUID ownerId) { + super(ownerId); + this.cardNumber = 202; + this.expansionSetCode = "7ED"; + } + + public ManaClash(final ManaClash card) { + super(card); + } + + @Override + public ManaClash copy() { + return new ManaClash(this); + } +} diff --git a/Mage.Sets/src/mage/sets/thedark/ManaClash.java b/Mage.Sets/src/mage/sets/thedark/ManaClash.java new file mode 100644 index 0000000000..16e9e6dd95 --- /dev/null +++ b/Mage.Sets/src/mage/sets/thedark/ManaClash.java @@ -0,0 +1,52 @@ +/* + * 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.thedark; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class ManaClash extends mage.sets.fourthedition.ManaClash { + + public ManaClash(UUID ownerId) { + super(ownerId); + this.cardNumber = 71; + this.expansionSetCode = "DRK"; + } + + public ManaClash(final ManaClash card) { + super(card); + } + + @Override + public ManaClash copy() { + return new ManaClash(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/PutOnLibraryTargetEffect.java b/Mage/src/mage/abilities/effects/common/PutOnLibraryTargetEffect.java index 82e673820d..a337cfc3d0 100644 --- a/Mage/src/mage/abilities/effects/common/PutOnLibraryTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/PutOnLibraryTargetEffect.java @@ -144,25 +144,25 @@ public class PutOnLibraryTargetEffect extends OneShotEffect { @Override public String getText(Mode mode) { - StringBuilder sb = new StringBuilder(); if (this.staticText != null && !this.staticText.isEmpty()) { - sb.append(staticText); - } else { - Target target = mode.getTargets().get(0); - sb.append("Put "); - if (target.getMaxNumberOfTargets() == 0) { - sb.append("any number of "); - } else { - if (target.getMaxNumberOfTargets() != 1 || target.getNumberOfTargets() != 1) { - if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) { - sb.append("up to "); - } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); - } - } - sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" on "); - sb.append(onTop ? "top" : "the bottom").append(" of it's owner's library"); + return staticText; } + StringBuilder sb = new StringBuilder(); + Target target = mode.getTargets().get(0); + sb.append("Put "); + if (target.getMaxNumberOfTargets() == 0) { + sb.append("any number of "); + } else { + if (target.getMaxNumberOfTargets() != 1 || target.getNumberOfTargets() != 1) { + if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) { + sb.append("up to "); + } + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + } + } + sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" on "); + sb.append(onTop ? "top" : "the bottom").append(" of it's owner's library"); + return sb.toString(); } diff --git a/Mage/src/mage/game/events/GameEvent.java b/Mage/src/mage/game/events/GameEvent.java index 50e4ab491f..aae2b81a16 100644 --- a/Mage/src/mage/game/events/GameEvent.java +++ b/Mage/src/mage/game/events/GameEvent.java @@ -175,7 +175,7 @@ public class GameEvent implements Serializable { SHUFFLE_LIBRARY, LIBRARY_SHUFFLED, ENCHANT_PLAYER, ENCHANTED_PLAYER, CAN_TAKE_MULLIGAN, - FLIP_COIN, SCRY, FATESEAL, + FLIP_COIN, COIN_FLIPPED, SCRY, FATESEAL, //permanent events ENTERS_THE_BATTLEFIELD, diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 20a8e6cd8a..e964a2522b 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -1665,9 +1665,7 @@ public abstract class PlayerImpl implements Player, Serializable { } else if (source instanceof CommandObject){ sourceControllerId = ((CommandObject) source).getControllerId(); sourceAbilities = ((CommandObject) source).getAbilities(); - } else { - source = null; - } + } } else { sourceAbilities = ((Permanent) source).getAbilities(game); sourceControllerId = ((Permanent) source).getControllerId(); @@ -2110,7 +2108,9 @@ public abstract class PlayerImpl implements Player, Serializable { } GameEvent event = new GameEvent(GameEvent.EventType.FLIP_COIN, playerId, null, playerId, 0, result); event.setAppliedEffects(appliedEffects); - game.replaceEvent(event); + if (!game.replaceEvent(event)) { + game.fireEvent(new GameEvent(GameEvent.EventType.COIN_FLIPPED, playerId, null, playerId, 0, event.getFlag())); + } return event.getFlag(); }