change BEcomesBasicLandTargetEffect to use SubType

This commit is contained in:
igoudt 2017-08-07 21:58:59 +02:00
parent ba4d9c9f44
commit 8d52e995e8
6 changed files with 39 additions and 33 deletions

View file

@ -27,10 +27,6 @@
*/
package mage.cards.c;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -61,6 +57,11 @@ import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.Watcher;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author MTGfan
@ -80,7 +81,7 @@ public class CyclopeanTomb extends CardImpl {
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.MIRE.createInstance()), new GenericManaCost(2), new IsStepCondition(PhaseStep.UPKEEP), "{2}, {T}: Put a mire counter on target non-Swamp land. That land is a Swamp for as long as it has a mire counter on it. Activate this ability only during your upkeep.");
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetLandPermanent(filter));
ability.addEffect(new BecomeSwampEffect(Duration.Custom, false, true, "Swamp"));
ability.addEffect(new BecomeSwampEffect(Duration.Custom, false, true, SubType.SWAMP));
this.addAbility(ability, new CyclopeanTombCounterWatcher());
// When Cyclopean Tomb is put into a graveyard from the battlefield, at the beginning of each of your upkeeps for the rest of the game, remove all mire counters from a land that a mire counter was put onto with Cyclopean Tomb but that a mire counter has not been removed from with Cyclopean Tomb.
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new CyclopeanTombCreateTriggeredEffect()));
@ -98,7 +99,7 @@ public class CyclopeanTomb extends CardImpl {
class BecomeSwampEffect extends BecomesBasicLandTargetEffect {
public BecomeSwampEffect(Duration duration, boolean chooseLandType, boolean loseOther, String... landNames) {
public BecomeSwampEffect(Duration duration, boolean chooseLandType, boolean loseOther, SubType... landNames) {
super(duration, chooseLandType, loseOther, landNames);
staticText = "That land is a Swamp for as long as it has a mire counter on it";
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -49,6 +48,8 @@ import mage.target.Target;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author cbt33, LevelX2 (Walk the Aeons), KholdFuzion (Dandan)
@ -65,7 +66,7 @@ public class Dreamwinder extends CardImpl {
// Dreamwinder can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent(SubType.ISLAND,"an Island"))));
// {U}, Sacrifice an Island: Target land becomes an Island until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, "Island"), new ManaCostsImpl("{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, SubType.ISLAND), new ManaCostsImpl("{U}"));
Target target = new TargetLandPermanent();
ability.addTarget(target);
FilterControlledLandPermanent filter = new FilterControlledLandPermanent("an Island");

View file

@ -27,7 +27,6 @@
*/
package mage.cards.k;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
@ -48,6 +47,8 @@ import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetLandPermanent;
import java.util.UUID;
/**
*
* @author fireshoes
@ -72,7 +73,7 @@ public class KukemssaSerpent extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent(SubType.ISLAND, "an Island"))));
// {U}, Sacrifice an Island: Target land an opponent controls becomes an Island until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, "Island"), new ManaCostsImpl("{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, SubType.ISLAND), new ManaCostsImpl("{U}"));
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filterControlledLand, true)));
ability.addTarget(new TargetLandPermanent(filterOpponentLand));
this.addAbility(ability);

View file

@ -27,7 +27,6 @@
*/
package mage.cards.q;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -52,6 +51,8 @@ import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -105,7 +106,7 @@ class QuicksilverFountainEffect extends OneShotEffect {
if (player.choose(Outcome.Neutral, targetNonIslandLand, source.getId(), game)) {
Permanent landChosen = game.getPermanent(targetNonIslandLand.getFirstTarget());
landChosen.addCounters(CounterType.FLOOD.createInstance(), source, game);
ContinuousEffect becomesBasicLandTargetEffect = new BecomesBasicLandTargetEffect(Duration.OneUse, "Island");
ContinuousEffect becomesBasicLandTargetEffect = new BecomesBasicLandTargetEffect(Duration.OneUse, SubType.ISLAND);
becomesBasicLandTargetEffect.addDependencyType(DependencyType.BecomeIsland);
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(becomesBasicLandTargetEffect, new LandHasFloodCounterCondition(this), staticText);
this.setTargetPointer(new FixedTarget(landChosen, game));

View file

@ -27,7 +27,6 @@
*/
package mage.cards.u;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.AddCardSubtypeAllEffect;
@ -38,6 +37,8 @@ import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterLandPermanent;
import java.util.UUID;
/**
*
* @author Plopman

View file

@ -39,6 +39,7 @@ import mage.players.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
/**
@ -49,38 +50,38 @@ import java.util.UUID;
public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
protected boolean chooseLandType;
protected ArrayList<String> landTypes = new ArrayList();
protected ArrayList<String> landTypesToAdd = new ArrayList();
protected List<SubType> landTypes = new ArrayList();
protected List<SubType> landTypesToAdd = new ArrayList();
protected boolean loseOther; // loses all other abilities, card types, and creature types
public BecomesBasicLandTargetEffect(Duration duration) {
this(duration, true, new String[0]);
this(duration, true);
}
public BecomesBasicLandTargetEffect(Duration duration, String... landNames) {
public BecomesBasicLandTargetEffect(Duration duration, SubType... landNames) {
this(duration, false, landNames);
}
public BecomesBasicLandTargetEffect(Duration duration, boolean chooseLandType, String... landNames) {
public BecomesBasicLandTargetEffect(Duration duration, boolean chooseLandType, SubType... landNames) {
this(duration, chooseLandType, true, landNames);
}
public BecomesBasicLandTargetEffect(Duration duration, boolean chooseLandType, boolean loseOther, String... landNames) {
public BecomesBasicLandTargetEffect(Duration duration, boolean chooseLandType, boolean loseOther, SubType... landNames) {
super(duration, Outcome.Detriment);
this.landTypes.addAll(Arrays.asList(landNames));
if (landTypes.contains("Mountain")) {
if (landTypes.contains(SubType.MOUNTAIN)) {
dependencyTypes.add(DependencyType.BecomeMountain);
}
if (landTypes.contains("Forest")) {
if (landTypes.contains(SubType.FOREST)) {
dependencyTypes.add(DependencyType.BecomeForest);
}
if (landTypes.contains("Swamp")) {
if (landTypes.contains(SubType.SWAMP)) {
dependencyTypes.add(DependencyType.BecomeSwamp);
}
if (landTypes.contains("Island")) {
if (landTypes.contains(SubType.ISLAND)) {
dependencyTypes.add(DependencyType.BecomeIsland);
}
if (landTypes.contains("Plains")) {
if (landTypes.contains(SubType.PLAINS)) {
dependencyTypes.add(DependencyType.BecomePlains);
}
this.chooseLandType = chooseLandType;
@ -116,7 +117,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
if (controller != null) {
Choice choice = new ChoiceBasicLandType();
controller.choose(outcome, choice, game);
landTypes.add(choice.getChoice());
landTypes.add(SubType.byDescription(choice.getChoice()));
} else {
this.discard();
}
@ -147,7 +148,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
land.getSubtype(game).addAll(landTypes);
} else {
landTypesToAdd.clear();
for (String subtype : landTypes) {
for (SubType subtype : landTypes) {
if (!land.getSubtype(game).contains(subtype)) {
land.getSubtype(game).add(subtype);
landTypesToAdd.add(subtype);
@ -156,21 +157,21 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
}
break;
case AbilityAddingRemovingEffects_6:
for (String landType : landTypesToAdd) {
for (SubType landType : landTypesToAdd) {
switch (landType) {
case "Swamp":
case SWAMP:
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
break;
case "Mountain":
case MOUNTAIN:
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
break;
case "Forest":
case FOREST:
land.addAbility(new GreenManaAbility(), source.getSourceId(), game);
break;
case "Island":
case ISLAND:
land.addAbility(new BlueManaAbility(), source.getSourceId(), game);
break;
case "Plains":
case PLAINS:
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
break;
}
@ -194,7 +195,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
} else {
sb.append("Target land becomes a ");
int i = 1;
for (String landType : landTypes) {
for (SubType landType : landTypes) {
if (i > 1) {
if (i == landTypes.size()) {
sb.append(" and ");