removed contains cardtype calls

This commit is contained in:
ingmargoudt 2017-04-06 16:38:34 +02:00
parent ea6ba3c0a9
commit f22ebd3677
3 changed files with 6 additions and 18 deletions

View file

@ -65,9 +65,7 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId()); Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) { if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) {
if (!permanent.getCardType().contains(addedCardType)) {
permanent.addCardType(addedCardType); permanent.addCardType(addedCardType);
}
return true; return true;
} else if (this.getDuration() == Duration.Custom) { } else if (this.getDuration() == Duration.Custom) {
this.discard(); this.discard();

View file

@ -42,7 +42,6 @@ import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements SourceEffect { public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements SourceEffect {
@ -113,13 +112,9 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
if (losePreviousTypes) { if (losePreviousTypes) {
permanent.getCardType().clear(); permanent.getCardType().clear();
} }
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) { for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.addCardType(t); permanent.addCardType(t);
} }
}
}
if (type != null && type.isEmpty() || type == null && permanent.isLand()) { if (type != null && type.isEmpty() || type == null && permanent.isLand()) {
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes()); permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
} }
@ -137,11 +132,10 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
break; break;
case AbilityAddingRemovingEffects_6: case AbilityAddingRemovingEffects_6:
if (sublayer == SubLayer.NA) { if (sublayer == SubLayer.NA) {
if (!token.getAbilities().isEmpty()) {
for (Ability ability : token.getAbilities()) { for (Ability ability : token.getAbilities()) {
permanent.addAbility(ability, source.getSourceId(), game); permanent.addAbility(ability, source.getSourceId(), game);
} }
}
} }
break; break;
case PTChangingEffects_7: case PTChangingEffects_7:

View file

@ -46,17 +46,13 @@ public class CardTypeApplier extends ApplyToPermanent {
@Override @Override
public boolean apply(Game game, Permanent permanent) { public boolean apply(Game game, Permanent permanent) {
if (!permanent.getCardType().contains(cardType)) {
permanent.addCardType(cardType); permanent.addCardType(cardType);
}
return true; return true;
} }
@Override @Override
public boolean apply(Game game, MageObject mageObject) { public boolean apply(Game game, MageObject mageObject) {
if (!mageObject.getCardType().contains(cardType)) {
mageObject.addCardType(cardType); mageObject.addCardType(cardType);
}
return true; return true;
} }
} }