diff --git a/Mage.Sets/src/mage/cards/g/GripOfPhyresis.java b/Mage.Sets/src/mage/cards/g/GripOfPhyresis.java new file mode 100644 index 0000000000..47f1264f5b --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GripOfPhyresis.java @@ -0,0 +1,114 @@ +/* + * 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.cards.g; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.GermToken; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetPermanent; + +/** + * + * @author spjspj + */ +public class GripOfPhyresis extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("Equipment"); + + static { + filter.add(new CardTypePredicate(CardType.ARTIFACT)); + filter.add(new SubtypePredicate("Equipment")); + } + + public GripOfPhyresis(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); + + // Gain control of target Equipment, then create a 0/0 black Germ creature token and attach that Equipment to it. + GainControlTargetEffect effect = new GainControlTargetEffect(Duration.EndOfGame, true); + effect.setText("Gain control of target equipment"); + this.getSpellAbility().addEffect(effect); + Target targetEquipment = new TargetPermanent(filter); + this.getSpellAbility().addTarget(targetEquipment); + this.getSpellAbility().addEffect(new GripOfPhyresisEffect()); + } + + public GripOfPhyresis(final GripOfPhyresis card) { + super(card); + } + + @Override + public GripOfPhyresis copy() { + return new GripOfPhyresis(this); + } +} + +class GripOfPhyresisEffect extends CreateTokenEffect { + + GripOfPhyresisEffect() { + super(new GermToken()); + } + + GripOfPhyresisEffect(final GripOfPhyresisEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent equipment = game.getPermanent(source.getFirstTarget()); + + if (controller != null && equipment != null) { + if (super.apply(game, source)) { + Permanent germ = game.getPermanent(this.getLastAddedTokenId()); + if (germ != null) { + germ.addAttachment(equipment.getId(), game); + return true; + } + } + } + return false; + } + + @Override + public GripOfPhyresisEffect copy() { + return new GripOfPhyresisEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2016.java b/Mage.Sets/src/mage/sets/Commander2016.java index ab8aaa1072..75375de9c7 100644 --- a/Mage.Sets/src/mage/sets/Commander2016.java +++ b/Mage.Sets/src/mage/sets/Commander2016.java @@ -180,6 +180,7 @@ public class Commander2016 extends ExpansionSet { cards.add(new SetCardInfo("Grab the Reins", 126, Rarity.UNCOMMON, mage.cards.g.GrabTheReins.class)); cards.add(new SetCardInfo("Grand Coliseum", 299, Rarity.RARE, mage.cards.g.GrandColiseum.class)); cards.add(new SetCardInfo("Grave Upheaval", 31, Rarity.UNCOMMON, mage.cards.g.GraveUpheaval.class)); + cards.add(new SetCardInfo("Grip of Phyresis", 9, Rarity.UNCOMMON, mage.cards.g.GripOfPhyresis.class)); cards.add(new SetCardInfo("Gruul Signet", 256, Rarity.COMMON, mage.cards.g.GruulSignet.class)); cards.add(new SetCardInfo("Gruul Turf", 300, Rarity.UNCOMMON, mage.cards.g.GruulTurf.class)); cards.add(new SetCardInfo("Guiltfeeder", 112, Rarity.RARE, mage.cards.g.Guiltfeeder.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/GermToken.java b/Mage/src/main/java/mage/game/permanent/token/GermToken.java new file mode 100644 index 0000000000..39af80aa80 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/GermToken.java @@ -0,0 +1,79 @@ +/* + * 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.game.permanent.token; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import mage.MageInt; +import mage.constants.CardType; + +/** + * @author spjspj + */ +public class GermToken extends Token { + + final static private List tokenImageSets = new ArrayList<>(); + + static { + tokenImageSets.addAll(Arrays.asList("NPH", "MBS", "SOM", "EMA", "C16")); + } + + public GermToken() { + this(null, 0); + } + + public GermToken(String setCode) { + this(setCode, 0); + } + + public GermToken(String setCode, int tokenType) { + super("Germ", "0/0 black Germ creature token"); + availableImageSetCodes = tokenImageSets; + setOriginalExpansionSetCode(setCode); + cardType.add(CardType.CREATURE); + color.setBlack(true); + subtype.add("Germ"); + power = new MageInt(0); + toughness = new MageInt(0); + } + + @Override + public void setExpansionSetCodeForImage(String code) { + super.setExpansionSetCodeForImage(code); + } + + public GermToken(final GermToken token) { + super(token); + } + + @Override + public GermToken copy() { + return new GermToken(this); + } +}