mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
parent
3c419a857f
commit
676b099590
2 changed files with 95 additions and 0 deletions
|
|
@ -8,10 +8,12 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
|
||||
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;
|
||||
|
||||
|
|
@ -52,8 +54,21 @@ public final class NearbyPlanet extends CardImpl {
|
|||
|
||||
class NearbyPlanetEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final Ability[] basicManaAbilities = {
|
||||
new WhiteManaAbility(),
|
||||
new BlueManaAbility(),
|
||||
new BlackManaAbility(),
|
||||
new RedManaAbility(),
|
||||
new GreenManaAbility()
|
||||
};
|
||||
|
||||
NearbyPlanetEffect() {
|
||||
super(Duration.Custom, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
dependendToTypes.add(DependencyType.BecomeMountain);
|
||||
dependendToTypes.add(DependencyType.BecomeForest);
|
||||
dependendToTypes.add(DependencyType.BecomeSwamp);
|
||||
dependendToTypes.add(DependencyType.BecomeIsland);
|
||||
dependendToTypes.add(DependencyType.BecomePlains);
|
||||
staticText = "Rangeling <i>(This card is every land type, including Plains, Island, Swamp, " +
|
||||
"Mountain, Forest, Desert, Gate, Lair, Locus, and all those Urza's ones.)</i>";
|
||||
}
|
||||
|
|
@ -75,6 +90,25 @@ class NearbyPlanetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
sourceObject.addSubType(game, SubType.PLAINS, SubType.ISLAND, SubType.SWAMP, SubType.MOUNTAIN, SubType.FOREST);
|
||||
sourceObject.setIsAllNonbasicLandTypes(game, true);
|
||||
// subtypes apply in all zones ^
|
||||
// mana abilities apply to permanent
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null) {
|
||||
return true;
|
||||
}
|
||||
// Optimization: Remove basic mana abilities since they are redundant with AnyColorManaAbility
|
||||
// and keeping them will only produce too many combinations inside ManaOptions
|
||||
for (Ability basicManaAbility : basicManaAbilities) {
|
||||
if (permanent.getAbilities(game).containsRule(basicManaAbility)) {
|
||||
permanent.removeAbility(basicManaAbility, source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
// Add the {T}: Add one mana of any color ability
|
||||
// This is functionally equivalent to having five "{T}: Add {COLOR}" for each COLOR in {W}{U}{B}{R}{G}
|
||||
AnyColorManaAbility ability = new AnyColorManaAbility();
|
||||
if (!permanent.getAbilities(game).containsRule(ability)) {
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package org.mage.test.cards.single.unf;
|
||||
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public class NearbyPlanetTest extends CardTestPlayerBase {
|
||||
|
||||
/*
|
||||
* Rangeling (This card is every land type, including Plains, Island, Swamp, Mountain, Forest,
|
||||
* Desert, Gate, Lair, Locus, and all those Urza’s ones.)
|
||||
* Nearby Planet enters tapped.
|
||||
* When Nearby Planet enters, sacrifice it unless you pay {1}.
|
||||
*/
|
||||
private final static String nearbyPlanet = "Nearby Planet";
|
||||
|
||||
@Test
|
||||
public void testDomain() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Wastes");
|
||||
addCard(Zone.HAND, playerA, nearbyPlanet);
|
||||
addCard(Zone.HAND, playerA, "Might of Alara");
|
||||
// Domain - Target creature gets +1/+1 until end of turn for each basic land type among lands you control.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Kraken Hatchling"); // 0/4
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, nearbyPlanet);
|
||||
setChoice(playerA, true); // pay {1}
|
||||
|
||||
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Might of Alara", "Kraken Hatchling");
|
||||
setChoice(playerA, "Green"); // color of mana to add
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Might of Alara", 1);
|
||||
assertPowerToughness(playerA, "Kraken Hatchling", 5, 9);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDesert() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Wastes");
|
||||
addCard(Zone.HAND, playerA, nearbyPlanet);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Solitary Camel"); // 3/2
|
||||
// Solitary Camel has lifelink as long as you control a Desert or there is a Desert card in your graveyard.
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, nearbyPlanet);
|
||||
setChoice(playerA, true); // pay {1}
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertAbility(playerA, "Solitary Camel", LifelinkAbility.getInstance(), true);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue