diff --git a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java index 0890cde733e..3a93ad629aa 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java +++ b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java @@ -206,21 +206,26 @@ public class PlayerPanelExt extends javax.swing.JPanel { } } this.avatar.setText(player.getName()); - String priorityTimeValue = getPriorityTimeLeftString(player); - this.timer.setCount(player.getPriorityTimeLeft()); - this.avatar.setTopText(priorityTimeValue); + if (player.getPriorityTimeLeft() != Integer.MAX_VALUE) { + String priorityTimeValue = getPriorityTimeLeftString(player); + this.timer.setCount(player.getPriorityTimeLeft()); + this.avatar.setTopText(priorityTimeValue); + } this.btnPlayer.setText(player.getName()); if (player.isActive()) { this.avatar.setBorder(greenBorder); this.btnPlayer.setBorder(greenBorder); - this.timer.resume(); } else if (player.hasLeft()) { this.avatar.setBorder(redBorder); this.btnPlayer.setBorder(redBorder); - this.timer.pause(); } else { this.avatar.setBorder(emptyBorder); this.btnPlayer.setBorder(emptyBorder); + } + + if (player.hasPriority()) { + this.timer.resume(); + } else { this.timer.pause(); } diff --git a/Mage.Common/src/mage/view/PlayerView.java b/Mage.Common/src/mage/view/PlayerView.java index f0e46419eaf..711e037d859 100644 --- a/Mage.Common/src/mage/view/PlayerView.java +++ b/Mage.Common/src/mage/view/PlayerView.java @@ -54,6 +54,7 @@ public class PlayerView implements Serializable { private int libraryCount; private int handCount; private boolean isActive; + private boolean hasPriority; private boolean hasLeft; private ManaPoolView manaPool; private SimpleCardsView graveyard = new SimpleCardsView(); @@ -74,6 +75,7 @@ public class PlayerView implements Serializable { this.handCount = player.getHand().size(); this.manaPool = new ManaPoolView(player.getManaPool()); this.isActive = (player.getId().equals(state.getActivePlayerId())); + this.hasPriority = player.getId().equals(state.getPriorityPlayerId()); this.hasLeft = player.hasLeft(); for (Card card: player.getGraveyard().getCards(game)) { graveyard.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.isFaceDown())); @@ -197,4 +199,8 @@ public class PlayerView implements Serializable { public int getPriorityTimeLeft() { return priorityTimeLeft; } + + public boolean hasPriority() { + return hasPriority; + } } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/ArcboundWanderer.java b/Mage.Sets/src/mage/sets/fifthdawn/ArcboundWanderer.java new file mode 100644 index 00000000000..e6484295d6f --- /dev/null +++ b/Mage.Sets/src/mage/sets/fifthdawn/ArcboundWanderer.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.fifthdawn; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class ArcboundWanderer extends mage.sets.modernmasters.ArcboundWanderer { + + public ArcboundWanderer(UUID ownerId) { + super(ownerId); + this.cardNumber = 103; + this.expansionSetCode = "5DN"; + this.rarity = Rarity.UNCOMMON; + } + + public ArcboundWanderer(final ArcboundWanderer card) { + super(card); + } + + @Override + public ArcboundWanderer copy() { + return new ArcboundWanderer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fifthdawn/BatonOfCourage.java b/Mage.Sets/src/mage/sets/fifthdawn/BatonOfCourage.java index 218eb307fc9..ad700127cc0 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/BatonOfCourage.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/BatonOfCourage.java @@ -56,7 +56,7 @@ public class BatonOfCourage extends CardImpl { // Flash this.addAbility(FlashAbility.getInstance()); // Sunburst - this.addAbility(new SunburstAbility()); + this.addAbility(new SunburstAbility(this)); // Remove a charge counter from Baton of Courage: Target creature gets +1/+1 until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(1, 1, Duration.EndOfTurn), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(1))); ability.addTarget(new TargetCreaturePermanent()); diff --git a/Mage.Sets/src/mage/sets/fifthdawn/ClearwaterGoblet.java b/Mage.Sets/src/mage/sets/fifthdawn/ClearwaterGoblet.java index dad83e18d8e..a5006adeacf 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/ClearwaterGoblet.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/ClearwaterGoblet.java @@ -51,7 +51,7 @@ public class ClearwaterGoblet extends CardImpl { this.expansionSetCode = "5DN"; // Sunburst - this.addAbility(new SunburstAbility()); + this.addAbility(new SunburstAbility(this)); // At the beginning of your upkeep, you may gain life equal to the number of charge counters on Clearwater Goblet. this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new GainLifeEffect(new CountersCount(CounterType.CHARGE)), TargetController.YOU, true)); } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java b/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java index 31aa69f8d7d..059d1f76c6b 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java @@ -58,7 +58,7 @@ public class EngineeredExplosives extends CardImpl { this.expansionSetCode = "5DN"; // Sunburst - this.addAbility(new SunburstAbility()); + this.addAbility(new SunburstAbility(this)); // {2}, Sacrifice Engineered Explosives: Destroy each nonland permanent with converted mana cost equal to the number of charge counters on Engineered Explosives. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new EngineeredExplosivesEffect(), new ManaCostsImpl("{2}")); ability.addCost(new SacrificeSourceCost()); diff --git a/Mage.Sets/src/mage/sets/fifthdawn/SawtoothThresher.java b/Mage.Sets/src/mage/sets/fifthdawn/SawtoothThresher.java index ef57a368362..811e9a46002 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/SawtoothThresher.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/SawtoothThresher.java @@ -56,7 +56,7 @@ public class SawtoothThresher extends CardImpl { this.toughness = new MageInt(1); // Sunburst - this.addAbility(new SunburstAbility()); + this.addAbility(new SunburstAbility(this)); // Remove two +1/+1 counters from Sawtooth Thresher: Sawtooth Thresher gets +4/+4 until end of turn. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(4, 4, Duration.EndOfTurn), new RemoveCountersSourceCost(CounterType.P1P1.createInstance(2)))); } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/SkyreachManta.java b/Mage.Sets/src/mage/sets/fifthdawn/SkyreachManta.java index a5ebb277535..f4a36ca5513 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/SkyreachManta.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/SkyreachManta.java @@ -49,7 +49,7 @@ public class SkyreachManta extends CardImpl { this.toughness = new MageInt(0); // Sunburst - this.addAbility(new SunburstAbility()); + this.addAbility(new SunburstAbility(this)); // Flying this.addAbility(FlyingAbility.getInstance()); } diff --git a/Mage.Sets/src/mage/sets/futuresight/Epochrasite.java b/Mage.Sets/src/mage/sets/futuresight/Epochrasite.java new file mode 100644 index 00000000000..f2943e24d2e --- /dev/null +++ b/Mage.Sets/src/mage/sets/futuresight/Epochrasite.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.futuresight; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class Epochrasite extends mage.sets.modernmasters.Epochrasite { + + public Epochrasite(UUID ownerId) { + super(ownerId); + this.cardNumber = 162; + this.expansionSetCode = "FUT"; + this.rarity = Rarity.RARE; + } + + public Epochrasite(final Epochrasite card) { + super(card); + } + + @Override + public Epochrasite copy() { + return new Epochrasite(this); + } +} diff --git a/Mage.Sets/src/mage/sets/lorwyn/WarrenPilferers.java b/Mage.Sets/src/mage/sets/lorwyn/WarrenPilferers.java new file mode 100644 index 00000000000..a3c79d6c8e8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/lorwyn/WarrenPilferers.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.lorwyn; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class WarrenPilferers extends mage.sets.modernmasters.WarrenPilferers { + + public WarrenPilferers(UUID ownerId) { + super(ownerId); + this.cardNumber = 146; + this.expansionSetCode = "LRW"; + } + + public WarrenPilferers(final WarrenPilferers card) { + super(card); + } + + @Override + public WarrenPilferers copy() { + return new WarrenPilferers(this); + } +} diff --git a/Mage.Sets/src/mage/sets/modernmasters/ArcboundWanderer.java b/Mage.Sets/src/mage/sets/modernmasters/ArcboundWanderer.java new file mode 100644 index 00000000000..f4dd03beadf --- /dev/null +++ b/Mage.Sets/src/mage/sets/modernmasters/ArcboundWanderer.java @@ -0,0 +1,63 @@ +/* + * 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.modernmasters; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.keyword.ModularAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class ArcboundWanderer extends CardImpl { + + public ArcboundWanderer(UUID ownerId) { + super(ownerId, 200, "Arcbound Wanderer", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}"); + this.expansionSetCode = "MMA"; + this.subtype.add("Golem"); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Modular-Sunburst + this.addAbility(new ModularAbility(this,0,true)); + + } + + public ArcboundWanderer(final ArcboundWanderer card) { + super(card); + } + + @Override + public ArcboundWanderer copy() { + return new ArcboundWanderer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/modernmasters/Epochrasite.java b/Mage.Sets/src/mage/sets/modernmasters/Epochrasite.java new file mode 100644 index 00000000000..d34353fdb5e --- /dev/null +++ b/Mage.Sets/src/mage/sets/modernmasters/Epochrasite.java @@ -0,0 +1,87 @@ +/* + * 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.modernmasters; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.condition.common.CastFromHandCondition; +import mage.abilities.condition.common.InvertCondition; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.common.ExileSourceEffect; +import mage.abilities.effects.common.continious.GainAbilitySourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.SuspendAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.watchers.common.CastFromHandWatcher; + +/** + * + * @author LevelX2 + */ +public class Epochrasite extends CardImpl { + + public Epochrasite(UUID ownerId) { + super(ownerId, 205, "Epochrasite", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}"); + this.expansionSetCode = "MMA"; + this.subtype.add("Construct"); + + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + this.addWatcher(new CastFromHandWatcher()); + + // Epochrasite enters the battlefield with three +1/+1 counters on it if you didn't cast it from your hand. + this.addAbility(new EntersBattlefieldAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)), + new InvertCondition(new CastFromHandCondition()), true, + "{this} enters the battlefield with three +1/+1 counters on it if you didn't cast it from your hand","")); + + // When Epochrasite dies, exile it with three time counters on it and it gains suspend. + Ability ability = new DiesTriggeredAbility(new ExileSourceEffect()); + ability.addEffect(new AddCountersSourceEffect(CounterType.TIME.createInstance(3), new StaticValue(0), false, true)); + ability.addEffect(new GainAbilitySourceEffect(new SuspendAbility(3, null, this), Duration.OneUse, true)); + this.addAbility(ability); + } + + public Epochrasite(final Epochrasite card) { + super(card); + } + + @Override + public Epochrasite copy() { + return new Epochrasite(this); + } +} + diff --git a/Mage.Sets/src/mage/sets/modernmasters/WarrenPilferers.java b/Mage.Sets/src/mage/sets/modernmasters/WarrenPilferers.java new file mode 100644 index 00000000000..c03290587cf --- /dev/null +++ b/Mage.Sets/src/mage/sets/modernmasters/WarrenPilferers.java @@ -0,0 +1,113 @@ +/* + * 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.modernmasters; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.GainAbilitySourceEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author LevelX2 + */ +public class WarrenPilferers extends CardImpl { + + public WarrenPilferers(UUID ownerId) { + super(ownerId, 103, "Warren Pilferers", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{B}"); + this.expansionSetCode = "MMA"; + this.subtype.add("Goblin"); + this.subtype.add("Rogue"); + + this.color.setBlack(true); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Warren Pilferers enters the battlefield, return target creature card from your graveyard to your hand. If that card is a Goblin card, Warren Pilferers gains haste until end of turn. + Ability ability = new EntersBattlefieldTriggeredAbility(new WarrenPilferersReturnEffect(), false); + ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard"))); + this.addAbility(ability); + } + + public WarrenPilferers(final WarrenPilferers card) { + super(card); + } + + @Override + public WarrenPilferers copy() { + return new WarrenPilferers(this); + } +} + +class WarrenPilferersReturnEffect extends OneShotEffect { + + public WarrenPilferersReturnEffect() { + super(Outcome.ReturnToHand); + staticText = "return target creature card from your graveyard to your hand. If that card is a Goblin card, Warren Pilferers gains haste until end of turn"; + } + + public WarrenPilferersReturnEffect(final WarrenPilferersReturnEffect effect) { + super(effect); + } + + @Override + public WarrenPilferersReturnEffect copy() { + return new WarrenPilferersReturnEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Card card = game.getCard(source.getFirstTarget()); + if (card != null) { + card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + if (card.getSubtype().contains("Goblin")) { + game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn), source); + } + return true; + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/planechase/EtchedOracle.java b/Mage.Sets/src/mage/sets/planechase/EtchedOracle.java index b62afa3c947..13fc76cb009 100644 --- a/Mage.Sets/src/mage/sets/planechase/EtchedOracle.java +++ b/Mage.Sets/src/mage/sets/planechase/EtchedOracle.java @@ -57,7 +57,7 @@ public class EtchedOracle extends CardImpl { this.toughness = new MageInt(0); // Sunburst (This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.) - this.addAbility(new SunburstAbility()); + this.addAbility(new SunburstAbility(this)); // {1}, Remove four +1/+1 counters from Etched Oracle: Target player draws three cards. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardTargetEffect(3), new ManaCostsImpl("{1}")); ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance(4))); diff --git a/Mage.Sets/src/mage/sets/planechase/PentadPrism.java b/Mage.Sets/src/mage/sets/planechase/PentadPrism.java index 2ec25226bcc..488a322cbb2 100644 --- a/Mage.Sets/src/mage/sets/planechase/PentadPrism.java +++ b/Mage.Sets/src/mage/sets/planechase/PentadPrism.java @@ -47,7 +47,7 @@ public class PentadPrism extends CardImpl { this.expansionSetCode = "HOP"; // Sunburst - this.addAbility(new SunburstAbility()); + this.addAbility(new SunburstAbility(this)); // Remove a charge counter from Pentad Prism: Add one mana of any color to your mana pool. this.addAbility(new AnyColorManaAbility(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(1)))); } diff --git a/Mage.Sets/src/mage/sets/planechase/SuntouchedMyr.java b/Mage.Sets/src/mage/sets/planechase/SuntouchedMyr.java index 6ca3efebcd8..5de6e02a4b3 100644 --- a/Mage.Sets/src/mage/sets/planechase/SuntouchedMyr.java +++ b/Mage.Sets/src/mage/sets/planechase/SuntouchedMyr.java @@ -48,7 +48,7 @@ public class SuntouchedMyr extends CardImpl { this.toughness = new MageInt(0); // Sunburst - this.addAbility(new SunburstAbility()); + this.addAbility(new SunburstAbility(this)); } public SuntouchedMyr(final SuntouchedMyr card) { diff --git a/Mage/src/mage/abilities/effects/common/continious/GainAbilitySourceEffect.java b/Mage/src/mage/abilities/effects/common/continious/GainAbilitySourceEffect.java index 978705f07ee..307ffd1bef3 100644 --- a/Mage/src/mage/abilities/effects/common/continious/GainAbilitySourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/GainAbilitySourceEffect.java @@ -30,6 +30,7 @@ package mage.abilities.effects.common.continious; import mage.abilities.Ability; import mage.abilities.effects.ContinuousEffectImpl; +import mage.cards.Card; import mage.constants.Duration; import mage.constants.Layer; import mage.constants.Outcome; @@ -44,6 +45,8 @@ import mage.game.permanent.Permanent; public class GainAbilitySourceEffect extends ContinuousEffectImpl { protected Ability ability; + // shall a card gain the ability (otherwise permanent) + private boolean onCard; /** * Add ability with Duration.WhileOnBattlefield @@ -54,14 +57,20 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl { private Counter counter; - protected boolean informPlayers; - protected DynamicValue amount; + private boolean informPlayers; + private DynamicValue amount; + private boolean putOnCard; public AddCountersSourceEffect(Counter counter) { this(counter, false); @@ -55,17 +57,23 @@ public class AddCountersSourceEffect extends OneShotEffect(This enters the battlefield with " + amount + " +1/+1 counter on it. When it dies, you may put its +1/+1 counters on target artifact creature.)"; + StringBuilder sb = new StringBuilder("Modular"); + if (sunburst) { + sb.append("-Sunburst (This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it. When it dies, you may put its +1/+1 counters on target artifact creature.)"); + } else { + sb.append(" ").append(amount).append(" (This enters the battlefield with ") + .append(amount).append(" +1/+1 counter on it. When it dies, you may put its +1/+1 counters on target artifact creature.)"); + } + return sb.toString(); } } class ModularStaticAbility extends StaticAbility { + private String ruleText; + public ModularStaticAbility(int amount) { super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount)))); + ruleText = new StringBuilder("This enters the battlefield with ").append(amount).append(" +1/+1 counter on it.").toString(); + this.setRuleVisible(false); } public ModularStaticAbility(final ModularStaticAbility ability) { super(ability); + this.ruleText = ability.ruleText; } @Override @@ -93,7 +118,7 @@ class ModularStaticAbility extends StaticAbility { @Override public String getRule() { - return ""; + return ruleText; } } diff --git a/Mage/src/mage/abilities/keyword/SunburstAbility.java b/Mage/src/mage/abilities/keyword/SunburstAbility.java index 9f42bdc4b9a..c7271b2fcd8 100644 --- a/Mage/src/mage/abilities/keyword/SunburstAbility.java +++ b/Mage/src/mage/abilities/keyword/SunburstAbility.java @@ -33,6 +33,7 @@ import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.SunburstCount; import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; import mage.constants.CardType; import mage.constants.Outcome; import mage.counters.Counter; @@ -49,12 +50,18 @@ import mage.players.Player; public class SunburstAbility extends EntersBattlefieldAbility{ - public SunburstAbility(){ + private final static String ruleCreature ="Sunburst (This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.)"; + private final static String ruleNonCreature ="Sunburst (This enters the battlefield with a charge counter on it for each color of mana spent to cast it.)"; + private boolean isCreature; + + public SunburstAbility(Card card){ super(new SunburstEffect(),""); + isCreature = card.getCardType().contains(CardType.CREATURE); } public SunburstAbility(final SunburstAbility ability){ super(ability); + this.isCreature = ability.isCreature; } @@ -65,7 +72,7 @@ public class SunburstAbility extends EntersBattlefieldAbility{ @Override public String getRule() { - return "Sunburst (This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.)"; + return isCreature ? ruleCreature : ruleNonCreature; } @@ -114,5 +121,4 @@ class SunburstEffect extends OneShotEffect { return new SunburstEffect(this); } - -} \ No newline at end of file +} diff --git a/Mage/src/mage/abilities/keyword/SuspendAbility.java b/Mage/src/mage/abilities/keyword/SuspendAbility.java index 0510cbe2d42..e9c57af4980 100644 --- a/Mage/src/mage/abilities/keyword/SuspendAbility.java +++ b/Mage/src/mage/abilities/keyword/SuspendAbility.java @@ -42,7 +42,6 @@ import mage.abilities.Ability; import mage.abilities.ActivatedAbilityImpl; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.SuspendedCondition; import mage.abilities.costs.mana.ManaCost; import mage.abilities.decorator.ConditionalTriggeredAbility; @@ -139,24 +138,37 @@ import mage.players.Player; public class SuspendAbility extends ActivatedAbilityImpl { private String ruleText; + private boolean gainedTemporary; + + /** + * Gives the card the SuspendAbility + * + * @param suspend - amount of time counters + * @param cost - null is used for temporary gained suspend ability + * @param card - card that has the suspend ability + */ public SuspendAbility(int suspend, ManaCost cost, Card card) { super(Zone.HAND, new SuspendExileEffect(suspend), cost); this.usesStack = false; - ruleText = new StringBuilder("Suspend ").append(suspend).append(" - ").append(cost.getText()) - .append(" (Rather than cast this card from your hand, pay ") - .append(cost.getText()) - .append(" and exile it with ") - .append(suspend == 1 ? "a time counter":suspend + " time counters") - .append(" on it.") - .append(" At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost.") - .append(card.getCardType().contains(CardType.CREATURE)? " If you play it this way and it's a creature, it gains haste until you lose control of it.":"") - .append(")") - .toString(); + StringBuilder sb = new StringBuilder("Suspend "); + if (cost != null) { + sb.append(suspend).append(" - ").append(cost.getText()) + .append(" (Rather than cast this card from your hand, pay ") + .append(cost.getText()) + .append(" and exile it with ") + .append(suspend == 1 ? "a time counter":suspend + " time counters") + .append(" on it.") + .append(" At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost.") + .append(card.getCardType().contains(CardType.CREATURE)? " If you play it this way and it's a creature, it gains haste until you lose control of it.":"") + .append(")"); + } else { + gainedTemporary = true; + } + ruleText = sb.toString(); if (card.getManaCost().isEmpty()) { setRuleAtTheTop(true); - } - + } // add triggered ability to remove the counter from the card Ability ability = new ConditionalTriggeredAbility( new BeginningOfUpkeepTriggeredAbility(Zone.EXILED, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), TargetController.YOU, false), @@ -164,19 +176,13 @@ public class SuspendAbility extends ActivatedAbilityImpl { "At the beginning of your upkeep, if this card is suspended, remove a time counter from it."); ability.setRuleVisible(false); card.addAbility(ability); - // add triggered ability that casts the suspended card, if all counters are removed card.addAbility(new SuspendPlayCardAbility(card.getCardType().contains(CardType.CREATURE))); - // if it's a creature card, add Haste ability - if (card.getCardType().contains(CardType.CREATURE)) { - ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainHasteEffect(Duration.WhileOnBattlefield)); - ability.setRuleVisible(false); - card.addAbility(ability); - } } public SuspendAbility(SuspendAbility ability) { super(ability); this.ruleText = ability.getRule(); + this.gainedTemporary = ability.gainedTemporary; } @Override @@ -196,6 +202,10 @@ public class SuspendAbility extends ActivatedAbilityImpl { return ruleText; } + public boolean isGainedTemporary() { + return gainedTemporary; + } + @Override public SuspendAbility copy() { return new SuspendAbility(this); @@ -252,6 +262,9 @@ class SuspendPlayCardAbility extends TriggeredAbilityImpl { public SuspendPlayCardEffect(boolean isCreature) { super(Outcome.PutCardInPlay); - this.staticText = new StringBuilder("play it without paying its mana cost if able. If you can't, it remains removed from the game") - .append(isCreature ? ". If you play it this way and it's a creature, it gains haste until you lose control of it":"").toString(); + this.staticText = "play it without paying its mana cost if able. If you can't, it remains removed from the game"; } public SuspendPlayCardEffect(final SuspendPlayCardEffect effect) { @@ -301,9 +313,23 @@ class SuspendPlayCardEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); Card card = game.getCard(source.getSourceId()); if (player != null && card != null) { + // remove temporary suspend ability (used e.g. for Epochrasite) + Ability abilityToRemove = null; + for (Ability ability : card.getAbilities()) { + if (ability instanceof SuspendAbility) { + if (((SuspendAbility)ability).isGainedTemporary()) { + abilityToRemove = ability; + } + } + } + if (abilityToRemove != null) { + card.getAbilities().remove(abilityToRemove); + } + // cast the card for free player.cast(card.getSpellAbility(), game, true); } return false; @@ -314,8 +340,8 @@ class GainHasteEffect extends ContinuousEffectImpl { private UUID suspendController; - public GainHasteEffect(Duration duration) { - super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); + public GainHasteEffect() { + super(Duration.Custom, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); staticText = "If you play it this way and it's a creature, it gains haste until you lose control of it"; } @@ -336,11 +362,11 @@ class GainHasteEffect extends ContinuousEffectImpl { } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - if (suspendController.equals(source.getControllerId()) && !used) { // used stores if the control changed + if (suspendController.equals(source.getControllerId())) { permanent.addAbility(HasteAbility.getInstance(), source.getSourceId(), game); return true; } else { - used = true; + this.discard(); } } return false; diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index ded8742beb5..12bdedd2e58 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -106,7 +106,7 @@ public abstract class PlayerImpl> implements Player, Ser protected boolean passedTurn; protected int turns; protected int storedBookmark = -1; - protected int priorityTimeLeft; + protected int priorityTimeLeft = Integer.MAX_VALUE; /** * This indicates that player passed all turns until his own turn starts.