Implemented Transmogrifying Wand

This commit is contained in:
Evan Kranzler 2018-06-22 08:44:15 -04:00
parent c59457b2e5
commit 266a7cdb85
4 changed files with 139 additions and 17 deletions

View file

@ -0,0 +1,91 @@
package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.OxToken;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public final class TransmogrifyingWand extends CardImpl {
public TransmogrifyingWand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Transmogrifying Wand enters the battlefield with three charge counters on it.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)),
"{this} enters the battlefield with three charge counters on it"
));
// {1}, {T}, Remove a charge counter from Transmogrifying Wand: Destroy target creature. Its controller creates a 2/4 white Ox creature token. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(
Zone.BATTLEFIELD,
new TransmogrifyingWandEffect(),
new GenericManaCost(1)
);
ability.addCost(new TapSourceCost());
ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public TransmogrifyingWand(final TransmogrifyingWand card) {
super(card);
}
@Override
public TransmogrifyingWand copy() {
return new TransmogrifyingWand(this);
}
}
class TransmogrifyingWandEffect extends OneShotEffect {
public TransmogrifyingWandEffect() {
super(Outcome.Benefit);
this.staticText = "Destroy target creature. Its controller creates a 2/4 white Ox creature token.";
}
public TransmogrifyingWandEffect(final TransmogrifyingWandEffect effect) {
super(effect);
}
@Override
public TransmogrifyingWandEffect copy() {
return new TransmogrifyingWandEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature == null) {
return false;
}
Effect effect = new CreateTokenTargetEffect(new OxToken());
effect.setTargetPointer(new FixedTarget(creature.getControllerId(), game));
new DestroyTargetEffect().apply(game, source);
return effect.apply(game, source);
}
}

View file

@ -1,5 +1,3 @@
package mage.cards.t;
import java.util.UUID;
@ -15,9 +13,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
/**
@ -25,20 +21,22 @@ import mage.target.TargetPermanent;
* @author Loki
*/
public final class TumbleMagnet extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or creature");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE)));
}
public TumbleMagnet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)), "Tumble Magnet enters the battlefield with three charge counters on it"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new TapSourceCost());
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)),
"{this} enters the battlefield with three charge counters on it"
));
Ability ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new TapTargetEffect(),
new TapSourceCost()
);
ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_CREATURE));
this.addAbility(ability);
}

View file

@ -259,6 +259,7 @@ public final class CoreSet2019 extends ExpansionSet {
cards.add(new SetCardInfo("Tolarian Scholar", 80, Rarity.COMMON, mage.cards.t.TolarianScholar.class));
cards.add(new SetCardInfo("Tormenting Voice", 164, Rarity.COMMON, mage.cards.t.TormentingVoice.class));
cards.add(new SetCardInfo("Totally Lost", 81, Rarity.COMMON, mage.cards.t.TotallyLost.class));
cards.add(new SetCardInfo("Transmogrifying Wand", 247, Rarity.RARE, mage.cards.t.TransmogrifyingWand.class));
cards.add(new SetCardInfo("Trumpet Blast", 165, Rarity.COMMON, mage.cards.t.TrumpetBlast.class));
cards.add(new SetCardInfo("Trusty Packbeast", 41, Rarity.COMMON, mage.cards.t.TrustyPackbeast.class));
cards.add(new SetCardInfo("Two-Headed Zombie", 123, Rarity.COMMON, mage.cards.t.TwoHeadedZombie.class));

View file

@ -0,0 +1,32 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public final class OxToken extends TokenImpl {
public OxToken() {
super("Ox", "2/4 white Ox creature token");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add(SubType.OX);
power = new MageInt(2);
toughness = new MageInt(4);
}
public OxToken(final OxToken token) {
super(token);
}
@Override
public OxToken copy() {
return new OxToken(this);
}
}