mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
change BEcomesBasicLandTargetEffect to use SubType
This commit is contained in:
parent
ba4d9c9f44
commit
8d52e995e8
6 changed files with 39 additions and 33 deletions
|
|
@ -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 ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue