Implemented Volrath, the Shapestealer

This commit is contained in:
Evan Kranzler 2019-08-06 19:19:35 -04:00
parent fa36f8e472
commit 59954c80df
2 changed files with 138 additions and 0 deletions

View file

@ -0,0 +1,137 @@
package mage.cards.v;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.CounterAnyPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.util.functions.ApplyToPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class VolrathTheShapestealer extends CardImpl {
static final FilterPermanent filter = new FilterCreaturePermanent("creature with a counter on it");
static {
filter.add(CounterAnyPredicate.instance);
}
public VolrathTheShapestealer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{G}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.SHAPESHIFTER);
this.power = new MageInt(7);
this.toughness = new MageInt(5);
// At the beginning of combat on your turn, put a -1/-1 counter on up to one target creature.
Ability ability = new BeginningOfCombatTriggeredAbility(
new AddCountersTargetEffect(CounterType.M1M1.createInstance()), TargetController.YOU, false
);
ability.addTarget(new TargetCreaturePermanent(0, 1));
this.addAbility(ability);
// {1}: Until your next turn, Volrath, the Shapestealer becomes a copy of target creature with a counter on it, except it's 7/5 and it has this ability.
ability = new SimpleActivatedAbility(new VolrathTheShapestealerEffect(), new GenericManaCost(1));
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
private VolrathTheShapestealer(final VolrathTheShapestealer card) {
super(card);
}
@Override
public VolrathTheShapestealer copy() {
return new VolrathTheShapestealer(this);
}
}
class VolrathTheShapestealerEffect extends OneShotEffect {
VolrathTheShapestealerEffect() {
super(Outcome.Copy);
staticText = "Until your next turn, {this} becomes a copy of target creature with a counter on it, " +
"except it's 7/5 and it has this ability.";
}
private VolrathTheShapestealerEffect(final VolrathTheShapestealerEffect effect) {
super(effect);
}
@Override
public VolrathTheShapestealerEffect copy() {
return new VolrathTheShapestealerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent volrathTheShapestealer = game.getPermanent(source.getSourceId());
Permanent newBluePrint = null;
if (controller == null
|| volrathTheShapestealer == null) {
return false;
}
Card copyFromCard = game.getPermanent(source.getFirstTarget());
if (copyFromCard == null) {
return true;
}
newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game);
newBluePrint.assignNewId();
ApplyToPermanent applier = new VolrathTheShapestealerApplier();
applier.apply(game, newBluePrint, source, volrathTheShapestealer.getId());
CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, volrathTheShapestealer.getId());
copyEffect.newId();
copyEffect.setApplier(applier);
Ability newAbility = source.copy();
copyEffect.init(newAbility, game);
game.addEffect(copyEffect, newAbility);
return true;
}
}
class VolrathTheShapestealerApplier extends ApplyToPermanent {
@Override
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
Ability ability = new SimpleActivatedAbility(new VolrathTheShapestealerEffect(), new GenericManaCost(1));
ability.addTarget(new TargetPermanent(VolrathTheShapestealer.filter));
permanent.getAbilities().add(ability);
permanent.getPower().modifyBaseValue(7);
permanent.getToughness().modifyBaseValue(5);
return true;
}
@Override
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
Ability ability = new SimpleActivatedAbility(new VolrathTheShapestealerEffect(), new GenericManaCost(1));
ability.addTarget(new TargetPermanent(VolrathTheShapestealer.filter));
mageObject.getAbilities().add(ability);
mageObject.getPower().modifyBaseValue(7);
mageObject.getToughness().modifyBaseValue(5);
return true;
}
}

View file

@ -74,6 +74,7 @@ public final class Commander2019Edition extends ExpansionSet {
cards.add(new SetCardInfo("Thran Dynamo", 223, Rarity.UNCOMMON, mage.cards.t.ThranDynamo.class));
cards.add(new SetCardInfo("Trail of Mystery", 186, Rarity.RARE, mage.cards.t.TrailOfMystery.class));
cards.add(new SetCardInfo("Vesuvan Shapeshifter", 101, Rarity.RARE, mage.cards.v.VesuvanShapeshifter.class));
cards.add(new SetCardInfo("Volrath, the Shapestealer", 51, Rarity.MYTHIC, mage.cards.v.VolrathTheShapestealer.class));
cards.add(new SetCardInfo("Vraska the Unseen", 207, Rarity.MYTHIC, mage.cards.v.VraskaTheUnseen.class));
}
}