From f94e05352e6bdf13bfee88d8ee02e3bdf89e9c6d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 16 Mar 2015 13:37:15 +0100 Subject: [PATCH] [DTK] Added 4 arifacts. (Artifacts complete) --- .../sets/dragonsoftarkir/GateSmasher.java | 96 ++++++++++++ .../sets/dragonsoftarkir/KeeperOfTheLens.java | 146 ++++++++++++++++++ .../sets/dragonsoftarkir/StormriderRig.java | 77 +++++++++ .../dragonsoftarkir/TapestryOfTheAges.java | 137 ++++++++++++++++ 4 files changed, 456 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/GateSmasher.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/KeeperOfTheLens.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/StormriderRig.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/TapestryOfTheAges.java diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/GateSmasher.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/GateSmasher.java new file mode 100644 index 00000000000..5319516f40f --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/GateSmasher.java @@ -0,0 +1,96 @@ +/* + * 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.dragonsoftarkir; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.Filter; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.ToughnessPredicate; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class GateSmasher extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature with 3 or more power"); + + static { + filter.add(new ToughnessPredicate(Filter.ComparisonType.GreaterThan, 3)); + } + + public GateSmasher(UUID ownerId) { + super(ownerId, 239, "Gate Smasher", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{3}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Equipment"); + + // Gate Smasher can be attached only to a creature with toughness 4 or greater. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect("{this} can be attached only to a creature with toughness 4 or greater"))); + + // Equipped creature gets +3/+0 and has trample. + Effect effect = new BoostEquippedEffect(3, 0); + effect.setText("Equipped creature gets +3/+0"); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect); + effect = new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.EQUIPMENT); + effect.setText("and has trample"); + ability.addEffect(effect); + this.addAbility(ability); + + // Equip {3} + this.addAbility(new EquipAbility( + Outcome.AddAbility, + new GenericManaCost(3), + new TargetControlledCreaturePermanent(1,1, filter, false))); + + } + + public GateSmasher(final GateSmasher card) { + super(card); + } + + @Override + public GateSmasher copy() { + return new GateSmasher(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/KeeperOfTheLens.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/KeeperOfTheLens.java new file mode 100644 index 00000000000..694cdc2ca25 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/KeeperOfTheLens.java @@ -0,0 +1,146 @@ +/* + * 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.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.ActivatedAbilityImpl; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.other.FaceDownPredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class KeeperOfTheLens extends CardImpl { + + public KeeperOfTheLens(UUID ownerId) { + super(ownerId, 240, "Keeper of the Lens", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Golem"); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // You may look at face-down creatures you don't control. + // TODO: this should be a static abilitie and not use activated abilities (because it could than be restriced) + this.addAbility(new KeeperOfTheLensLookFaceDownAbility()); + } + + public KeeperOfTheLens(final KeeperOfTheLens card) { + super(card); + } + + @Override + public KeeperOfTheLens copy() { + return new KeeperOfTheLens(this); + } +} + +class KeeperOfTheLensLookFaceDownAbility extends ActivatedAbilityImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("face down creature you don't control"); + + static { + filter.add(new FaceDownPredicate()); + filter.add(new ControllerPredicate(TargetController.NOT_YOU)); + } + + public KeeperOfTheLensLookFaceDownAbility() { + super(Zone.BATTLEFIELD, new KeeperOfTheLensLookFaceDownEffect(), new GenericManaCost(0)); + this.usesStack = false; + this.addTarget(new TargetCreaturePermanent(filter)); + } + + public KeeperOfTheLensLookFaceDownAbility(KeeperOfTheLensLookFaceDownAbility ability) { + super(ability); + } + + @Override + public KeeperOfTheLensLookFaceDownAbility copy() { + return new KeeperOfTheLensLookFaceDownAbility(this); + } + +} + +class KeeperOfTheLensLookFaceDownEffect extends OneShotEffect { + + public KeeperOfTheLensLookFaceDownEffect() { + super(Outcome.Benefit); + this.staticText = "You may look at face-down creatures you don't control"; + } + + public KeeperOfTheLensLookFaceDownEffect(final KeeperOfTheLensLookFaceDownEffect effect) { + super(effect); + } + + @Override + public KeeperOfTheLensLookFaceDownEffect copy() { + return new KeeperOfTheLensLookFaceDownEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller= game.getPlayer(source.getControllerId()); + MageObject mageObject = game.getObject(source.getSourceId()); + if (controller == null || mageObject == null) { + return false; + } + Permanent faceDownCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (faceDownCreature != null) { + Permanent copyFaceDown = faceDownCreature.copy(); + copyFaceDown.setFaceDown(false, game); + Cards cards = new CardsImpl(); + cards.add(copyFaceDown); + Player player = game.getPlayer(faceDownCreature.getControllerId()); + controller.lookAtCards("face down card - " + mageObject.getLogName(), cards, game); + if (player != null) { + game.informPlayers(controller.getName() + " looks at a face down creature of " + player.getName()); + } + } else { + return false; + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/StormriderRig.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/StormriderRig.java new file mode 100644 index 00000000000..0ed9c01a239 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/StormriderRig.java @@ -0,0 +1,77 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SetTargetPointer; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class StormriderRig extends CardImpl { + + public StormriderRig(UUID ownerId) { + super(ownerId, 245, "Stormrider Rig", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Equipment"); + + // Equipped creature gets +1/+1. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1))); + + // Whenever a creature enters the battlefield under your control, you may attach Stormrider Rig to it. + this.addAbility(new EntersBattlefieldAllTriggeredAbility( + Zone.BATTLEFIELD, new AttachEffect(Outcome.Detriment, "attach {source} to it"), + new FilterControlledCreaturePermanent(), true, SetTargetPointer.PERMANENT, null, true)); + + // Equip {2} + this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2))); + + } + + public StormriderRig(final StormriderRig card) { + super(card); + } + + @Override + public StormriderRig copy() { + return new StormriderRig(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/TapestryOfTheAges.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/TapestryOfTheAges.java new file mode 100644 index 00000000000..a06844574fe --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/TapestryOfTheAges.java @@ -0,0 +1,137 @@ +/* + * 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.dragonsoftarkir; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.WatcherScope; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.Spell; +import mage.watchers.Watcher; + + +/** + * + * @author LevelX2 + */ +public class TapestryOfTheAges extends CardImpl { + + public TapestryOfTheAges(UUID ownerId) { + super(ownerId, 246, "Tapestry of the Ages", Rarity.UNCOMMON, new CardType[]{}, "Artifact"); + this.expansionSetCode = "DTK"; + + // {2}, {T}: Draw a card. Activate this ability only if you've cast a noncreature spell this turn. + Ability ability = new ActivateIfConditionActivatedAbility( + Zone.BATTLEFIELD, + new DrawCardSourceControllerEffect(1), + new ManaCostsImpl<>("{2}"), + PlayerCastNonCreatureSpellCondition.getInstance()); + ability.addCost(new TapSourceCost()); + this.addAbility(ability, new PlayerCastNonCreatureSpellWatcher()); + + } + + public TapestryOfTheAges(final TapestryOfTheAges card) { + super(card); + } + + @Override + public TapestryOfTheAges copy() { + return new TapestryOfTheAges(this); + } +} + +class PlayerCastNonCreatureSpellCondition implements Condition { + private final static PlayerCastNonCreatureSpellCondition fInstance = new PlayerCastNonCreatureSpellCondition(); + + public static Condition getInstance() { + return fInstance; + } + + @Override + public boolean apply(Game game, Ability source) { + PlayerCastNonCreatureSpellWatcher watcher = (PlayerCastNonCreatureSpellWatcher) game.getState().getWatchers().get("PlayerCastNonCreatureSpell"); + return watcher != null && !watcher.playerDidCastNonCreatureSpellThisTurn(source.getControllerId()); + } + + @Override + public String toString() { + return "you've cast a noncreature spell this turn"; + } +} + +class PlayerCastNonCreatureSpellWatcher extends Watcher { + + Set playerIds = new HashSet<>(); + + public PlayerCastNonCreatureSpellWatcher() { + super("PlayerCastNonCreatureSpell", WatcherScope.GAME); + } + + public PlayerCastNonCreatureSpellWatcher(final PlayerCastNonCreatureSpellWatcher watcher) { + super(watcher); + this.playerIds.addAll(watcher.playerIds); + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.SPELL_CAST) { + Spell spell = (Spell) game.getObject(event.getTargetId()); + if (!spell.getCardType().contains(CardType.CREATURE)) { + playerIds.add(spell.getControllerId()); + } + } + } + + @Override + public PlayerCastNonCreatureSpellWatcher copy() { + return new PlayerCastNonCreatureSpellWatcher(this); + } + + @Override + public void reset() { + super.reset(); + playerIds.clear(); + } + + public boolean playerDidCastNonCreatureSpellThisTurn(UUID playerId) { + return playerIds.contains(playerId); + } +}