forked from External/mage
[SPM] Implement Multiversal Passage
This commit is contained in:
parent
ef9f917c59
commit
9921648522
3 changed files with 167 additions and 0 deletions
125
Mage.Sets/src/mage/cards/m/MultiversalPassage.java
Normal file
125
Mage.Sets/src/mage/cards/m/MultiversalPassage.java
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseBasicLandTypeEffect;
|
||||
import mage.abilities.effects.common.TapSourceUnlessPaysEffect;
|
||||
import mage.abilities.mana.*;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jmlundeen
|
||||
*/
|
||||
public final class MultiversalPassage extends CardImpl {
|
||||
|
||||
public MultiversalPassage(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
|
||||
|
||||
|
||||
// As this land enters, choose a basic land type. Then you may pay 2 life. If you don't, it enters tapped.
|
||||
Ability ability = new AsEntersBattlefieldAbility(new ChooseBasicLandTypeEffect(Outcome.Benefit));
|
||||
ability.addEffect(new TapSourceUnlessPaysEffect(new PayLifeCost(2)));
|
||||
this.addAbility(ability);
|
||||
|
||||
// This land is the chosen type.
|
||||
this.addAbility(new SimpleStaticAbility(new MultiversalPassagePassageEffect()));
|
||||
}
|
||||
|
||||
private MultiversalPassage(final MultiversalPassage card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiversalPassage copy() {
|
||||
return new MultiversalPassage(this);
|
||||
}
|
||||
}
|
||||
class MultiversalPassagePassageEffect extends ContinuousEffectImpl {
|
||||
|
||||
MultiversalPassagePassageEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
|
||||
staticText = "This land is the chosen type.";
|
||||
}
|
||||
|
||||
private MultiversalPassagePassageEffect(final MultiversalPassagePassageEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiversalPassagePassageEffect copy() {
|
||||
return new MultiversalPassagePassageEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
SubType choice = SubType.byDescription((String) game.getState().getValue(source.getSourceId().toString() + ChooseBasicLandTypeEffect.VALUE_KEY));
|
||||
if (choice == null) {
|
||||
discard();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (choice) {
|
||||
case PLAINS:
|
||||
dependencyTypes.add(DependencyType.BecomePlains);
|
||||
break;
|
||||
case ISLAND:
|
||||
dependencyTypes.add(DependencyType.BecomeIsland);
|
||||
break;
|
||||
case SWAMP:
|
||||
dependencyTypes.add(DependencyType.BecomeSwamp);
|
||||
break;
|
||||
case MOUNTAIN:
|
||||
dependencyTypes.add(DependencyType.BecomeMountain);
|
||||
break;
|
||||
case FOREST:
|
||||
dependencyTypes.add(DependencyType.BecomeForest);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SubType choice = SubType.byDescription((String) game.getState().getValue(source.getSourceId().toString() + ChooseBasicLandTypeEffect.VALUE_KEY));
|
||||
if (choice == null) {
|
||||
return false;
|
||||
}
|
||||
Ability ability;
|
||||
switch (choice) {
|
||||
case PLAINS:
|
||||
ability = new WhiteManaAbility();
|
||||
break;
|
||||
case ISLAND:
|
||||
ability = new BlueManaAbility();
|
||||
break;
|
||||
case SWAMP:
|
||||
ability = new BlackManaAbility();
|
||||
break;
|
||||
case MOUNTAIN:
|
||||
ability = new RedManaAbility();
|
||||
break;
|
||||
case FOREST:
|
||||
ability = new GreenManaAbility();
|
||||
break;
|
||||
default:
|
||||
ability = null;
|
||||
}
|
||||
Permanent land = game.getPermanent(source.getSourceId());
|
||||
if (land == null || land.hasSubtype(choice, game)) {
|
||||
return false;
|
||||
}
|
||||
land.addSubType(game, choice);
|
||||
land.addAbility(ability, source.getSourceId(), game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -54,6 +54,8 @@ public final class MarvelsSpiderMan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Merciless Enforcers", 58, Rarity.COMMON, mage.cards.m.MercilessEnforcers.class));
|
||||
cards.add(new SetCardInfo("Mountain", 192, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Mountain", 197, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Multiversal Passage", 180, Rarity.RARE, mage.cards.m.MultiversalPassage.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Multiversal Passage", 206, Rarity.RARE, mage.cards.m.MultiversalPassage.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Origin of Spider-Man", 218, Rarity.RARE, mage.cards.o.OriginOfSpiderMan.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Origin of Spider-Man", 9, Rarity.RARE, mage.cards.o.OriginOfSpiderMan.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Oscorp Research Team", 40, Rarity.COMMON, mage.cards.o.OscorpResearchTeam.class));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package org.mage.test.cards.single.spm;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jmlundeen
|
||||
*/
|
||||
public class MultiversalPassageTest extends CardTestPlayerBase {
|
||||
|
||||
/*
|
||||
Multiversal Passage
|
||||
|
||||
Land
|
||||
As this land enters, choose a basic land type. Then you may pay 2 life. If you don't, it enters tapped.
|
||||
This land is the chosen type.
|
||||
*/
|
||||
private static final String multiversalPassage = "Multiversal Passage";
|
||||
|
||||
@Test
|
||||
public void testMultiversalPassage() {
|
||||
setStrictChooseMode(true);
|
||||
|
||||
addCard(Zone.HAND, playerA, multiversalPassage);
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, multiversalPassage);
|
||||
setChoice(playerA, "Swamp");
|
||||
setChoice(playerA, true); // untapped
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertSubtype(multiversalPassage, SubType.SWAMP);
|
||||
assertLife(playerA, 20 - 2);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue