mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[SPM] implement The Spot, Living Portal
This commit is contained in:
parent
d0ee2fef06
commit
8f1050a834
4 changed files with 203 additions and 3 deletions
82
Mage.Sets/src/mage/cards/t/TheSpotLivingPortal.java
Normal file
82
Mage.Sets/src/mage/cards/t/TheSpotLivingPortal.java
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.common.PutSourceOnBottomOwnerLibraryCost;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.ExileTargetForSourceEffect;
|
||||
import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.common.TargetNonlandPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jmlundeen
|
||||
*/
|
||||
public final class TheSpotLivingPortal extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("nonland permanent card from a graveyard");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
Arrays.stream(CardType.values())
|
||||
.filter(CardType::isPermanentType)
|
||||
.filter(type -> type != CardType.LAND)
|
||||
.map(CardType::getPredicate)
|
||||
.collect(Collectors.toSet()))
|
||||
);
|
||||
}
|
||||
|
||||
public TheSpotLivingPortal(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{B}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.SCIENTIST);
|
||||
this.subtype.add(SubType.VILLAIN);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// When The Spot enters, exile up to one target nonland permanent and up to one target nonland permanent card from a graveyard.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetForSourceEffect()
|
||||
.setTargetPointer(new EachTargetPointer()));
|
||||
ability.addTarget(new TargetNonlandPermanent(0, 1));
|
||||
ability.addTarget(new TargetCardInGraveyard(0, 1, filter));
|
||||
this.addAbility(ability);
|
||||
|
||||
// When The Spot dies, put him on the bottom of his owner's library. If you do, return the exiled cards to their owners' hands.
|
||||
DoIfCostPaid effect = new DoIfCostPaid(
|
||||
new ReturnFromExileForSourceEffect(Zone.HAND)
|
||||
.withText(true, true, false),
|
||||
null,
|
||||
new PutSourceOnBottomOwnerLibraryCost()
|
||||
.setText("put him on the bottom of his owner's library"),
|
||||
false
|
||||
);
|
||||
this.addAbility(new DiesSourceTriggeredAbility(effect, false));
|
||||
}
|
||||
|
||||
private TheSpotLivingPortal(final TheSpotLivingPortal card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TheSpotLivingPortal copy() {
|
||||
return new TheSpotLivingPortal(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -273,6 +273,8 @@ public final class MarvelsSpiderMan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("The Clone Saga", 219, Rarity.RARE, mage.cards.t.TheCloneSaga.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("The Clone Saga", 28, Rarity.RARE, mage.cards.t.TheCloneSaga.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("The Spot's Portal", 68, Rarity.UNCOMMON, mage.cards.t.TheSpotsPortal.class));
|
||||
cards.add(new SetCardInfo("The Spot, Living Portal", 153, Rarity.RARE, mage.cards.t.TheSpotLivingPortal.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("The Spot, Living Portal", 231, Rarity.RARE, mage.cards.t.TheSpotLivingPortal.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Thwip!", 20, Rarity.COMMON, mage.cards.t.Thwip.class));
|
||||
cards.add(new SetCardInfo("Tombstone, Career Criminal", 70, Rarity.UNCOMMON, mage.cards.t.TombstoneCareerCriminal.class));
|
||||
cards.add(new SetCardInfo("Ultimate Green Goblin", 157, Rarity.RARE, mage.cards.u.UltimateGreenGoblin.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
package org.mage.test.cards.single.spm;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.player.TestPlayer;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jmlundeen
|
||||
*/
|
||||
public class TheSpotLivingPortalTest extends CardTestPlayerBase {
|
||||
|
||||
/*
|
||||
The Spot, Living Portal
|
||||
{3}{W}{B}
|
||||
Legendary Creature - Human Scientist Villain
|
||||
When The Spot enters, exile up to one target nonland permanent and up to one target nonland permanent card from a graveyard.
|
||||
When The Spot dies, put him on the bottom of his owner's library. If you do, return the exiled cards to their owners' hands.
|
||||
4/4
|
||||
*/
|
||||
private static final String theSpotLivingPortal = "The Spot, Living Portal";
|
||||
|
||||
/*
|
||||
Bear Cub
|
||||
{1}{G}
|
||||
Creature - Bear
|
||||
|
||||
2/2
|
||||
*/
|
||||
private static final String bearCub = "Bear Cub";
|
||||
|
||||
/*
|
||||
Fugitive Wizard
|
||||
{U}
|
||||
Creature - Human Wizard
|
||||
|
||||
1/1
|
||||
*/
|
||||
private static final String fugitiveWizard = "Fugitive Wizard";
|
||||
|
||||
@Test
|
||||
public void testTheSpotLivingPortal() {
|
||||
setStrictChooseMode(true);
|
||||
|
||||
addCustomEffect_TargetDestroy(playerB);
|
||||
addCard(Zone.HAND, playerA, theSpotLivingPortal);
|
||||
addCard(Zone.GRAVEYARD, playerA, bearCub);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Scrubland", 5);
|
||||
addCard(Zone.BATTLEFIELD, playerB, fugitiveWizard);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, theSpotLivingPortal);
|
||||
addTarget(playerA, bearCub);
|
||||
addTarget(playerA, fugitiveWizard);
|
||||
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "target destroy");
|
||||
addTarget(playerB, theSpotLivingPortal);
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerA, bearCub, 1);
|
||||
assertHandCount(playerB, fugitiveWizard, 1);
|
||||
assertLibraryCount(playerA, theSpotLivingPortal, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnlyGraveyard() {
|
||||
setStrictChooseMode(true);
|
||||
|
||||
addCustomEffect_TargetDestroy(playerB);
|
||||
addCard(Zone.HAND, playerA, theSpotLivingPortal);
|
||||
addCard(Zone.GRAVEYARD, playerA, bearCub);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Scrubland", 5);
|
||||
addCard(Zone.BATTLEFIELD, playerB, fugitiveWizard);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, theSpotLivingPortal);
|
||||
addTarget(playerA, TestPlayer.TARGET_SKIP);
|
||||
addTarget(playerA, bearCub);
|
||||
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "target destroy");
|
||||
addTarget(playerB, theSpotLivingPortal);
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerA, bearCub, 1);
|
||||
assertLibraryCount(playerA, theSpotLivingPortal, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnlyBattlefield() {
|
||||
setStrictChooseMode(true);
|
||||
|
||||
addCustomEffect_TargetDestroy(playerB);
|
||||
addCard(Zone.HAND, playerA, theSpotLivingPortal);
|
||||
addCard(Zone.GRAVEYARD, playerA, bearCub);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Scrubland", 5);
|
||||
addCard(Zone.BATTLEFIELD, playerB, fugitiveWizard);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, theSpotLivingPortal);
|
||||
addTarget(playerA, fugitiveWizard);
|
||||
addTarget(playerA, TestPlayer.TARGET_SKIP);
|
||||
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "target destroy");
|
||||
addTarget(playerB, theSpotLivingPortal);
|
||||
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerB, fugitiveWizard, 1);
|
||||
assertLibraryCount(playerA, theSpotLivingPortal, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.abilities.costs.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
|
|
@ -10,6 +9,8 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
@ -27,7 +28,7 @@ public class PutSourceOnBottomOwnerLibraryCost extends CostImpl {
|
|||
@Override
|
||||
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (player != null && sourcePermanent != null) {
|
||||
paid = true;
|
||||
player.putCardsOnBottomOfLibrary(new CardsImpl(sourcePermanent), game, ability, false);
|
||||
|
|
@ -37,7 +38,7 @@ public class PutSourceOnBottomOwnerLibraryCost extends CostImpl {
|
|||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
|
||||
return game.getPermanent(source.getSourceId()) != null;
|
||||
return game.getPermanentOrLKIBattlefield(source.getSourceId()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue