AddCardSubtypeAllEffect uses SubType enum

This commit is contained in:
igoudt 2017-08-08 17:11:21 +02:00
parent 19a8f3c4c1
commit 2ca7927580
7 changed files with 13 additions and 27 deletions

View file

@ -32,7 +32,6 @@ import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -43,9 +42,9 @@ import mage.game.permanent.Permanent;
public class AddCardSubtypeAllEffect extends ContinuousEffectImpl {
private static FilterPermanent filter;
private static String addedSubtype;
private static SubType addedSubtype;
public AddCardSubtypeAllEffect(FilterPermanent _filter, String _addedSubtype, DependencyType _dependency) {
public AddCardSubtypeAllEffect(FilterPermanent _filter, SubType _addedSubtype, DependencyType _dependency) {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
filter = _filter;
staticText = "";

View file

@ -94,7 +94,7 @@ class AuraSwapEffect extends OneShotEffect {
if (controller != null) {
Permanent auraSourcePermanent = game.getPermanent(source.getSourceId());
if (auraSourcePermanent != null
&& auraSourcePermanent.getSubtype(game).contains("Aura")
&& auraSourcePermanent.getSubtype(game).contains(SubType.AURA)
&& auraSourcePermanent.getOwnerId().equals(source.getControllerId())) {
Permanent enchantedPermanent = game.getPermanent(auraSourcePermanent.getAttachedTo());
filterCardToCheck.add(new AuraCardCanAttachToPermanentId(enchantedPermanent.getId()));

View file

@ -110,8 +110,8 @@ class EmbalmEffect extends OneShotEffect {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer)
token.getColor(game).setColor(ObjectColor.WHITE);
if (!token.getSubtype(game).contains("Zombie")) {
token.getSubtype(game).add(0, "Zombie");
if (!token.getSubtype(game).contains(SubType.ZOMBIE)) {
token.getSubtype(game).add(0, SubType.ZOMBIE);
}
token.getManaCost().clear();
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EMBALMED_CREATURE, token.getId(), source.getSourceId(), controller.getId()));

View file

@ -27,7 +27,6 @@
*/
package mage.game.permanent;
import java.util.*;
import mage.MageObject;
import mage.MageObjectReference;
import mage.ObjectColor;
@ -56,6 +55,8 @@ import mage.players.Player;
import mage.util.GameLog;
import mage.util.ThreadLocalStringBuilder;
import java.util.*;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -925,7 +926,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public boolean cantBeAttachedBy(MageObject source, Game game) {
for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) {
if (!(source.getSubtype(game).contains("Aura")
if (!(source.getSubtype(game).contains(SubType.AURA)
&& !ability.removesAuras())
&& !source.getId().equals(ability.getAuraIdNotToBeRemoved())
&& !ability.canTarget(source, game)) {

View file

@ -9,15 +9,6 @@ import java.util.stream.Collectors;
public class SubTypeList extends ArrayList<SubType> {
public void add(int index, String s) {
add(index, SubType.byDescription(s));
}
public void add(int index, SubType s) {
super.add(index, s);
}
public boolean addAll(List<String> subtypes) {
return addAll(subtypes.stream().map(SubType::byDescription).collect(Collectors.toList()));
}
@ -26,9 +17,6 @@ public class SubTypeList extends ArrayList<SubType> {
return removeAll(subtypes.stream().map(SubType::byDescription).collect(Collectors.toList()));
}
public boolean add(SubType s) {
return super.add(s);
}
public boolean add(SubType... subTypes) {
return Collections.addAll(this, subTypes);