[LCI] Implement Get Lost

This commit is contained in:
Susucre 2023-10-27 17:38:14 +02:00
parent 92a4f41b2b
commit c6441b31a5
3 changed files with 52 additions and 4 deletions

View file

@ -0,0 +1,47 @@
package mage.cards.g;
import mage.abilities.effects.common.CreateTokenControllerTargetPermanentEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.game.permanent.token.MapToken;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author Susucr
*/
public final class GetLost extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("creature, enchantment, or planeswalker");
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.ENCHANTMENT.getPredicate(),
CardType.PLANESWALKER.getPredicate()
));
}
public GetLost(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// Destroy target creature, enchantment, or planeswalker. Its controller creates two Map tokens.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addEffect(new CreateTokenControllerTargetPermanentEffect(new MapToken(), 2, false));
this.getSpellAbility().addTarget(new TargetPermanent(filter));
}
private GetLost(final GetLost card) {
super(card);
}
@Override
public GetLost copy() {
return new GetLost(this);
}
}

View file

@ -35,6 +35,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet {
cards.add(new SetCardInfo("Dinotomaton", 144, Rarity.COMMON, mage.cards.d.Dinotomaton.class));
cards.add(new SetCardInfo("Forest", 401, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Geological Appraiser", 150, Rarity.UNCOMMON, mage.cards.g.GeologicalAppraiser.class));
cards.add(new SetCardInfo("Get Lost", 14, Rarity.RARE, mage.cards.g.GetLost.class));
cards.add(new SetCardInfo("Ghalta, Stampede Tyrant", 185, Rarity.MYTHIC, mage.cards.g.GhaltaStampedeTyrant.class));
cards.add(new SetCardInfo("Gishath, Sun's Avatar", 229, Rarity.MYTHIC, mage.cards.g.GishathSunsAvatar.class));
cards.add(new SetCardInfo("Goldfury Strider", 152, Rarity.UNCOMMON, mage.cards.g.GoldfuryStrider.class));

View file

@ -13,7 +13,7 @@ import mage.util.CardUtil;
/**
* @author Susucr
*
* <p>
* Have the Controller of target permanent (or LKI controller) create Tokens.
*/
public class CreateTokenControllerTargetPermanentEffect extends OneShotEffect {
@ -51,9 +51,9 @@ public class CreateTokenControllerTargetPermanentEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (creature != null) {
Player controllerOfTarget = game.getPlayer(creature.getControllerId());
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (permanent != null) {
Player controllerOfTarget = game.getPlayer(permanent.getControllerId());
if (controllerOfTarget != null) {
int value = amount.calculate(game, source, this);
return token.putOntoBattlefield(value, game, source, controllerOfTarget.getId(), tapped, false);