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) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) {
if (!permanent.getCardType().contains(addedCardType)) {
permanent.addCardType(addedCardType);
}
permanent.addCardType(addedCardType);
return true;
} else if (this.getDuration() == Duration.Custom) {
this.discard();

View file

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

View file

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