diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/PraetorsCounsel.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/PraetorsCounsel.java new file mode 100644 index 0000000000..63a2364c9f --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/PraetorsCounsel.java @@ -0,0 +1,96 @@ +/* + * Copyright 2011 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.mirrodinbesieged; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Duration; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileSpellEffect; +import mage.abilities.effects.common.continious.MaximumHandSizeControllerEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class PraetorsCounsel extends CardImpl { + + public PraetorsCounsel(UUID ownerId) { + super(ownerId, 88, "Praetor's Counsel", Rarity.MYTHIC, new CardType[]{CardType.SORCERY}, "{5}{G}{G}{G}"); + this.expansionSetCode = "MBS"; + this.color.setGreen(true); + this.getSpellAbility().addEffect(new PraetorsCounselEffect()); + this.getSpellAbility().addEffect(ExileSpellEffect.getInstance()); + this.getSpellAbility().addEffect(new MaximumHandSizeControllerEffect(Integer.MAX_VALUE, Duration.EndOfGame, false)); + } + + public PraetorsCounsel(final PraetorsCounsel card) { + super(card); + } + + @Override + public PraetorsCounsel copy() { + return new PraetorsCounsel(this); + } + +} + +class PraetorsCounselEffect extends OneShotEffect { + + public PraetorsCounselEffect() { + super(Outcome.DrawCard); + this.staticText = "Return all cards from your graveyard to your hand"; + } + + public PraetorsCounselEffect(final PraetorsCounselEffect effect) { + super(effect); + } + + @Override + public PraetorsCounselEffect copy() { + return new PraetorsCounselEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + for (Card card: player.getGraveyard().getCards(game)) { + player.putInHand(card, game); + } + player.getGraveyard().clear(); + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java new file mode 100644 index 0000000000..f7b4caeac7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java @@ -0,0 +1,214 @@ +/* + * Copyright 2011 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.mirrodinbesieged; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Duration; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.BecomesCreatureTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.counters.CounterType; +import mage.filter.Filter; +import mage.filter.FilterCard; +import mage.filter.common.FilterArtifactCard; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.token.Token; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.TargetPlayer; +import mage.target.common.TargetArtifactPermanent; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class TezzeretAgentOfBolas extends CardImpl { + + public TezzeretAgentOfBolas(UUID ownerId) { + super(ownerId, 97, "Tezzeret, Agent of Bolas", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{2}{U}{B}"); + this.expansionSetCode = "MBS"; + this.subtype.add("Tezzeret"); + this.color.setBlue(true); + this.color.setBlack(true); + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), "")); + + this.addAbility(new LoyaltyAbility(new TezzeretAgentOfBolasEffect1(), 1)); + + LoyaltyAbility ability1 = new LoyaltyAbility(new BecomesCreatureTargetEffect(new ArtifactCreatureToken(), "", Duration.EndOfGame), -1); + ability1.addTarget(new TargetArtifactPermanent()); + this.addAbility(ability1); + + LoyaltyAbility ability2 = new LoyaltyAbility(new TezzeretAgentOfBolasEffect2(), -4); + ability2.addTarget(new TargetPlayer()); + this.addAbility(ability2); + + } + + public TezzeretAgentOfBolas(final TezzeretAgentOfBolas card) { + super(card); + } + + @Override + public TezzeretAgentOfBolas copy() { + return new TezzeretAgentOfBolas(this); + } + +} + +class TezzeretAgentOfBolasEffect1 extends OneShotEffect { + + protected static FilterCard filter1 = new FilterArtifactCard("artifact card to reveal and put into your hand"); + protected static FilterCard filter2 = new FilterCard("card to put on the bottom of your library"); + + public TezzeretAgentOfBolasEffect1() { + super(Outcome.DrawCard); + staticText = "Look at the top five cards of your library. You may reveal an artifact card from among them and put it into your hand. Put the rest on the bottom of your library in any order"; + } + + public TezzeretAgentOfBolasEffect1(final TezzeretAgentOfBolasEffect1 effect) { + super(effect); + } + + @Override + public TezzeretAgentOfBolasEffect1 copy() { + return new TezzeretAgentOfBolasEffect1(this); + } + + @Override + public boolean apply(Game game, Ability source) { + + Player player = game.getPlayer(source.getControllerId()); + Cards cards = new CardsImpl(Zone.PICK); + for (int i = 0; i < 5; i++) { + Card card = player.getLibrary().removeFromTop(game); + cards.add(card); + game.setZone(card.getId(), Zone.PICK); + } + player.lookAtCards("Tezzeret, Agent of Bolas", cards, game); + if (player.chooseUse(outcome, "Do you wish to reveal an artifact card and put it into your hand?", game)) { + TargetCard target1 = new TargetCard(Zone.PICK, filter1); + while (cards.size() > 0 && player.choose(Outcome.DrawCard, cards, target1, game)) { + Card card = cards.get(target1.getFirstTarget(), game); + if (card != null) { + cards.remove(card); + card.moveToZone(Zone.HAND, source.getId(), game, false); + Cards reveal = new CardsImpl(Zone.OUTSIDE); + reveal.add(card); + player.revealCards("Tezzeret, Agent of Bolas", reveal, game); + break; + } + target1.clearChosen(); + } + } + if (cards.size() > 1) { + TargetCard target2 = new TargetCard(Zone.PICK, filter2); + target2.setRequired(true); + while (cards.size() > 1) { + player.choose(Outcome.Benefit, cards, target2, game); + Card card = cards.get(target2.getFirstTarget(), game); + if (card != null) { + cards.remove(card); + card.moveToZone(Zone.LIBRARY, source.getId(), game, false); + } + target2.clearChosen(); + } + } + if (cards.size() == 1) { + Card card = cards.get(cards.iterator().next(), game); + card.moveToZone(Zone.LIBRARY, source.getId(), game, false); + } + return true; + } +} + +class ArtifactCreatureToken extends Token { + + public ArtifactCreatureToken() { + super("", "5/5 artifact creature"); + this.cardType.add(CardType.CREATURE); + + this.power = new MageInt(5); + this.toughness = new MageInt(5); + } +} + +class TezzeretAgentOfBolasEffect2 extends OneShotEffect { + + final static FilterControlledPermanent filter = new FilterControlledPermanent("artifacts"); + + static { + filter.getCardType().add(CardType.ARTIFACT); + filter.setScopeCardType(Filter.ComparisonScope.Any); + } + + public TezzeretAgentOfBolasEffect2() { + super(Outcome.DrawCard); + staticText = "Target player loses X life and you gain X life, where X is twice the number of artifacts you control"; + } + + public TezzeretAgentOfBolasEffect2(final TezzeretAgentOfBolasEffect2 effect) { + super(effect); + } + + @Override + public TezzeretAgentOfBolasEffect2 copy() { + return new TezzeretAgentOfBolasEffect2(this); + } + + @Override + public boolean apply(Game game, Ability source) { + DynamicValue value = new PermanentsOnBattlefieldCount(filter); + int count = value.calculate(game, source) * 2; + + Player player = game.getPlayer(source.getFirstTarget()); + if (player != null) { + player.loseLife(count, game); + } + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + controller.gainLife(count, game); + } + return true; + } + +} diff --git a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java new file mode 100644 index 0000000000..8eb02217bf --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java @@ -0,0 +1,128 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.effects.common.continious; + +import mage.Constants.Duration; +import mage.Constants.Layer; +import mage.Constants.Outcome; +import mage.Constants.SubLayer; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Token; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class BecomesCreatureTargetEffect extends ContinuousEffectImpl { + + protected Token token; + protected String type; + + public BecomesCreatureTargetEffect(Token token, String type, Duration duration) { + super(duration, Outcome.BecomeCreature); + this.token = token; + this.type = type; + } + + public BecomesCreatureTargetEffect(final BecomesCreatureTargetEffect effect) { + super(effect); + token = effect.token.copy(); + type = effect.type; + } + + @Override + public BecomesCreatureTargetEffect copy() { + return new BecomesCreatureTargetEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent != null) { + switch (layer) { + case TypeChangingEffects_4: + if (sublayer == SubLayer.NA) { + if (token.getCardType().size() > 0) + permanent.getCardType().addAll(token.getCardType()); + if (token.getSubtype().size() > 0) + permanent.getSubtype().addAll(token.getSubtype()); + } + break; + case ColorChangingEffects_5: + if (sublayer == SubLayer.NA) { + if (token.getColor().hasColor()) + permanent.getColor().setColor(token.getColor()); + } + break; + case AbilityAddingRemovingEffects_6: + if (sublayer == SubLayer.NA) { + if (token.getAbilities().size() > 0) { + for (Ability ability: token.getAbilities()) { + permanent.addAbility(ability); + } + } + } + break; + case PTChangingEffects_7: + if (sublayer == SubLayer.SetPT_7b) { + if (token.getPower() != MageInt.EmptyMageInt) + permanent.getPower().setValue(token.getPower().getValue()); + if (token.getToughness() != MageInt.EmptyMageInt) + permanent.getToughness().setValue(token.getToughness().getValue()); + } + } + } + return true; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == layer.TypeChangingEffects_4; + } + + @Override + public String getText(Mode mode) { + StringBuilder sb = new StringBuilder(); + sb.append(duration.toString()); + sb.append(" target ").append(mode.getTargets().get(0).getTargetName()).append(" becomes a ").append(token.getDescription()); + if (type.length() > 0) + sb.append(" that's still a ").append(type); + return sb.toString(); + } + +}