From 320dd240c1443fc951979482fd3770a9aeb1ccd9 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Fri, 18 May 2012 18:57:47 +0400 Subject: [PATCH] [AVR] 3 cards --- .../sets/avacynrestored/ConjurersCloset.java | 65 +++++++++ .../avacynrestored/GallowsAtWillowHill.java | 123 ++++++++++++++++++ .../sets/avacynrestored/OtherworldAtlas.java | 106 +++++++++++++++ ...eginningOfYourEndStepTriggeredAbility.java | 3 + 4 files changed, 297 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/ConjurersCloset.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/GallowsAtWillowHill.java create mode 100644 Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java diff --git a/Mage.Sets/src/mage/sets/avacynrestored/ConjurersCloset.java b/Mage.Sets/src/mage/sets/avacynrestored/ConjurersCloset.java new file mode 100644 index 0000000000..bcb6d6b52d --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/ConjurersCloset.java @@ -0,0 +1,65 @@ +/* + * 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.avacynrestored; + +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; +import mage.abilities.effects.common.ExileTargetForSourceEffect; +import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect; +import mage.cards.CardImpl; +import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class ConjurersCloset extends CardImpl { + + public ConjurersCloset(UUID ownerId) { + super(ownerId, 214, "Conjurer's Closet", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}"); + this.expansionSetCode = "AVR"; + + // At the beginning of your end step, you may exile target creature you control, then return that card to the battlefield under your control. + Ability ability = new BeginningOfYourEndStepTriggeredAbility(new ExileTargetForSourceEffect("Conjurer's Closet Exile"), true); + ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect()); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); + } + + public ConjurersCloset(final ConjurersCloset card) { + super(card); + } + + @Override + public ConjurersCloset copy() { + return new ConjurersCloset(this); + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/GallowsAtWillowHill.java b/Mage.Sets/src/mage/sets/avacynrestored/GallowsAtWillowHill.java new file mode 100644 index 0000000000..a5e766e6d8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/GallowsAtWillowHill.java @@ -0,0 +1,123 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.common.TapTargetCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.filter.Filter; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.SpiritWhiteToken; +import mage.game.permanent.token.Token; +import mage.players.Player; +import mage.target.common.TargetControlledPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class GallowsAtWillowHill extends CardImpl { + + private final static FilterControlledPermanent humanFilter = new FilterControlledPermanent("untapped Human you control"); + + static { + humanFilter.setTapped(false); + humanFilter.setUseTapped(true); + humanFilter.getSubtype().add("Human"); + humanFilter.setScopeSubtype(Filter.ComparisonScope.Any); + } + + public GallowsAtWillowHill(UUID ownerId) { + super(ownerId, 215, "Gallows at Willow Hill", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}"); + this.expansionSetCode = "AVR"; + + // {3}, {tap}, Tap three untapped Humans you control: Destroy target creature. Its controller puts a 1/1 white Spirit creature token with flying onto the battlefield. + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GallowsAtWillowHillEffect(), new GenericManaCost(3)); + ability.addCost(new TapSourceCost()); + ability.addCost(new TapTargetCost(new TargetControlledPermanent(3, 3, humanFilter, false))); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + public GallowsAtWillowHill(final GallowsAtWillowHill card) { + super(card); + } + + @Override + public GallowsAtWillowHill copy() { + return new GallowsAtWillowHill(this); + } +} + +class GallowsAtWillowHillEffect extends OneShotEffect { + + public GallowsAtWillowHillEffect() { + super(Constants.Outcome.DestroyPermanent); + staticText = "Destroy target creature. Its controller puts a 1/1 white Spirit creature token with flying onto the battlefield"; + } + + public GallowsAtWillowHillEffect(final GallowsAtWillowHillEffect effect) { + super(effect); + } + + @Override + public GallowsAtWillowHillEffect copy() { + return new GallowsAtWillowHillEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int affectedTargets = 0; + if (targetPointer.getTargets(source).size() > 0) { + for (UUID permanentId : targetPointer.getTargets(source)) { + Permanent permanent = game.getPermanent(permanentId); + if (permanent != null) { + Player controller = game.getPlayer(permanent.getControllerId()); + permanent.destroy(source.getId(), game, false); + if (controller != null) { + Token spirit = new SpiritWhiteToken(); + spirit.putOntoBattlefield(1, game, source.getSourceId(), controller.getId()); + } + affectedTargets++; + } + } + } + return affectedTargets > 0; + } +} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java b/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java new file mode 100644 index 0000000000..2993e6ef70 --- /dev/null +++ b/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java @@ -0,0 +1,106 @@ +/* + * 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.avacynrestored; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author noxx + */ +public class OtherworldAtlas extends CardImpl { + + public OtherworldAtlas(UUID ownerId) { + super(ownerId, 219, "Otherworld Atlas", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{4}"); + this.expansionSetCode = "AVR"; + + // {tap}: Put a charge counter on Otherworld Atlas. + this.addAbility(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost())); + + // {tap}: Each player draws a card for each charge counter on Otherworld Atlas. + this.addAbility(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new OtherworldAtlasDrawEffect(), new TapSourceCost())); + } + + public OtherworldAtlas(final OtherworldAtlas card) { + super(card); + } + + @Override + public OtherworldAtlas copy() { + return new OtherworldAtlas(this); + } +} + +class OtherworldAtlasDrawEffect extends OneShotEffect { + + public OtherworldAtlasDrawEffect() { + super(Constants.Outcome.DrawCard); + staticText = "Each player draws a card for each charge counter on {this}"; + } + + public OtherworldAtlasDrawEffect(final OtherworldAtlasDrawEffect effect) { + super(effect); + } + + @Override + public OtherworldAtlasDrawEffect copy() { + return new OtherworldAtlasDrawEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player sourcePlayer = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + int amount = permanent.getCounters().getCount(CounterType.CHARGE); + if (amount > 0) { + for (UUID playerId : sourcePlayer.getInRange()) { + Player player = game.getPlayer(playerId); + if (player != null) { + player.drawCards(amount, game); + } + } + } + } + return true; + } + +} diff --git a/Mage/src/mage/abilities/common/BeginningOfYourEndStepTriggeredAbility.java b/Mage/src/mage/abilities/common/BeginningOfYourEndStepTriggeredAbility.java index 788817c78b..23b72a13c4 100644 --- a/Mage/src/mage/abilities/common/BeginningOfYourEndStepTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/BeginningOfYourEndStepTriggeredAbility.java @@ -35,6 +35,9 @@ public class BeginningOfYourEndStepTriggeredAbility extends TriggeredAbilityImpl @Override public String getRule() { + if (optional) { + return "At the beginning of your end step, you may " + modes.getText(); + } return "At the beginning of your end step, " + modes.getText(); } }