Implemented Lazav, the Multifarious

This commit is contained in:
Evan Kranzler 2018-09-16 17:27:21 -04:00
parent e7af7c922a
commit d3aea0270c
4 changed files with 171 additions and 8 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.g;
import java.util.UUID;
@ -16,13 +15,15 @@ import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.TargetAdjustment;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.other.OwnerPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInOpponentsGraveyard;
import mage.target.common.TargetCardInGraveyard;
/**
* @author nantuko
@ -32,6 +33,7 @@ public final class GethLordOfTheVault extends CardImpl {
private static final FilterCard filter = new FilterCard("artifact or creature card with converted mana cost X from an opponent's graveyard");
static {
filter.add(new OwnerPredicate(TargetController.OPPONENT));
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE)));
@ -51,7 +53,7 @@ public final class GethLordOfTheVault extends CardImpl {
// Then that player puts the top X cards of their library into their graveyard.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GethLordOfTheVaultEffect(), new ManaCostsImpl("{X}{B}"));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD);
ability.addTarget(new TargetCardInOpponentsGraveyard(filter));
ability.addTarget(new TargetCardInGraveyard(filter));
this.addAbility(ability);
}

View file

@ -0,0 +1,160 @@
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyEffect;
import mage.abilities.effects.keyword.SurveilEffect;
import mage.cards.Card;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetAdjustment;
import mage.constants.TargetController;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.other.OwnerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
import mage.target.targetpointer.FixedTarget;
import mage.util.functions.ApplyToPermanent;
/**
*
* @author TheElk801
*/
public final class LazavTheMultifarious extends CardImpl {
private static final FilterCard filter = new FilterCreatureCard("creature card in your graveyard with converted mana cost X");
static {
filter.add(new OwnerPredicate(TargetController.YOU));
}
public LazavTheMultifarious(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.SHAPESHIFTER);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// When Lazav, the Multifarious enters the battlefield, surveil 1.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new SurveilEffect(1), false
));
// {X}: Lazav, the Multifarious becomes a copy of target creature card in your graveyard with converted mana cost X, except its name is Lazav, the Multifarious, it's legendary in addition to its other types, and it has this ability.
Ability ability = new SimpleActivatedAbility(
new LazavTheMultifariousEffect(),
new ManaCostsImpl("{X}")
);
ability.addTarget(new TargetCardInGraveyard(filter));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD);
this.addAbility(ability);
}
public LazavTheMultifarious(final LazavTheMultifarious card) {
super(card);
}
@Override
public LazavTheMultifarious copy() {
return new LazavTheMultifarious(this);
}
}
class LazavTheMultifariousEffect extends OneShotEffect {
LazavTheMultifariousEffect() {
super(Outcome.Copy);
staticText = "{this} becomes a copy of target creature card "
+ "in your graveyard with converted mana cost X, "
+ "except its name is Lazav, the Multifarious, "
+ "it's legendary in addition to its other types, "
+ "and it has this ability";
}
LazavTheMultifariousEffect(final LazavTheMultifariousEffect effect) {
super(effect);
}
@Override
public LazavTheMultifariousEffect copy() {
return new LazavTheMultifariousEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent lazavTheMultifarious = game.getPermanent(source.getSourceId());
Permanent newBluePrint = null;
if (controller != null
&& lazavTheMultifarious != null) {
Card copyFromCard = game.getCard(((FixedTarget) getTargetPointer()).getTarget());
if (copyFromCard != null) {
newBluePrint = new PermanentCard((Card) copyFromCard, source.getControllerId(), game);
newBluePrint.assignNewId();
ApplyToPermanent applier = new LazavTheMultifariousApplier();
applier.apply(game, newBluePrint, source, lazavTheMultifarious.getId());
CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, lazavTheMultifarious.getId());
copyEffect.newId();
copyEffect.setApplier(applier);
Ability newAbility = source.copy();
copyEffect.init(newAbility, game);
game.addEffect(copyEffect, newAbility);
}
return true;
}
return false;
}
}
class LazavTheMultifariousApplier extends ApplyToPermanent {
private static final FilterCard filter = new FilterCreatureCard("creature card in your graveyard with converted mana cost X");
static {
filter.add(new OwnerPredicate(TargetController.YOU));
}
@Override
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
Ability ability = new SimpleActivatedAbility(
new LazavTheMultifariousEffect(),
new ManaCostsImpl("{X}")
);
ability.addTarget(new TargetCardInGraveyard(filter));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD);
permanent.getAbilities().add(ability);
permanent.setName("Lazav, the Multifarious");
permanent.addSuperType(SuperType.LEGENDARY);
return true;
}
@Override
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
Ability ability = new SimpleActivatedAbility(
new LazavTheMultifariousEffect(),
new ManaCostsImpl("{X}")
);
ability.addTarget(new TargetCardInGraveyard(filter));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD);
mageObject.getAbilities().add(ability);
mageObject.setName("Lazav, the Multifarious");
mageObject.addSuperType(SuperType.LEGENDARY);
return true;
}
}

View file

@ -103,6 +103,7 @@ public final class GuildsOfRavnica extends ExpansionSet {
cards.add(new SetCardInfo("Izzet Locket", 238, Rarity.COMMON, mage.cards.i.IzzetLocket.class));
cards.add(new SetCardInfo("Knight of Autumn", 183, Rarity.RARE, mage.cards.k.KnightOfAutumn.class));
cards.add(new SetCardInfo("Lava Coil", 108, Rarity.UNCOMMON, mage.cards.l.LavaCoil.class));
cards.add(new SetCardInfo("Lazav, the Multifarious", 184, Rarity.MYTHIC, mage.cards.l.LazavTheMultifarious.class));
cards.add(new SetCardInfo("League Guildmage", 185, Rarity.UNCOMMON, mage.cards.l.LeagueGuildmage.class));
cards.add(new SetCardInfo("Ledev Guardian", 18, Rarity.COMMON, mage.cards.l.LedevGuardian.class));
cards.add(new SetCardInfo("Legion Guildmage", 187, Rarity.UNCOMMON, mage.cards.l.LegionGuildmage.class));

View file

@ -36,7 +36,6 @@ import mage.game.stack.StackObject;
import mage.target.TargetCard;
import mage.target.TargetPermanent;
import mage.target.TargetSpell;
import mage.target.common.TargetCardInOpponentsGraveyard;
import mage.target.common.TargetCreaturePermanent;
import mage.util.GameLog;
import mage.util.SubTypeList;
@ -49,6 +48,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import mage.target.common.TargetCardInGraveyard;
public abstract class CardImpl extends MageObjectImpl implements Card {
@ -395,13 +395,13 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
ability.addTarget(new TargetPermanent(0, xValue, permanentFilter, false));
}
break;
case X_CMC_EQUAL_GY_CARD: //Geth, Lord of the Vault only
case X_CMC_EQUAL_GY_CARD:
xValue = ability.getManaCostsToPay().getX();
TargetCard oldTarget = (TargetCard) ability.getTargets().get(0);
FilterCard filterCard = oldTarget.getFilter().copy();
FilterCard filterCard = ((TargetCard) ability.getTargets().get(0)).getFilter().copy();
filterCard.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
filterCard.setMessage(filterCard.getMessage().replace('X', (char) xValue));
ability.getTargets().clear();
ability.getTargets().add(new TargetCardInOpponentsGraveyard(filterCard));
ability.getTargets().add(new TargetCardInGraveyard(filterCard));
break;
case CHOSEN_NAME: //Declaration of Naught only
ability.getTargets().clear();