changed enum equals to ==, removed contains check for set

This commit is contained in:
ingmargoudt 2017-03-07 21:47:11 +01:00
parent 46ab7daf55
commit 1bc8e2248b
18 changed files with 42 additions and 50 deletions

View file

@ -63,7 +63,7 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl {
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (Duration.Custom.equals(this.duration) || this.duration.toString().startsWith("End")) {
if (this.duration == Duration.Custom || this.duration.toString().startsWith("End")) {
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId()), game));
if (affectedObjectList.isEmpty()) {
this.discard();

View file

@ -116,7 +116,7 @@ public class BecomesColorTargetEffect extends ContinuousEffectImpl {
targetObject.getColor(game).setColor(setColor);
}
}
if (!objectFound && this.getDuration().equals(Duration.Custom)) {
if (!objectFound && this.getDuration() == Duration.Custom) {
this.discard();
}
return true;

View file

@ -40,7 +40,6 @@ import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
/**
*
* @author jeff
*/
public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
@ -86,11 +85,9 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (!token.getSupertype().isEmpty()) {
for (String t : token.getSupertype()) {
if (!permanent.getSupertype().contains(t)) {
permanent.getSupertype().add(t);
}
for (String t : token.getSupertype()) {
if (!permanent.getSupertype().contains(t)) {
permanent.getSupertype().add(t);
}
}
// card type
@ -100,13 +97,10 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
permanent.getCardType().clear();
break;
}
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.getCardType().add(t);
}
}
for (CardType t : token.getCardType()) {
permanent.getCardType().add(t);
}
// sub type
switch (loseType) {
case ALL:
@ -115,18 +109,17 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
permanent.getSubtype(game).retainAll(CardRepository.instance.getLandTypes());
break;
}
if (!token.getSubtype(game).isEmpty()) {
for (String t : token.getSubtype(game)) {
if (!permanent.getSubtype(game).contains(t)) {
permanent.getSubtype(game).add(t);
}
for (String t : token.getSubtype(game)) {
if (!permanent.getSubtype(game).contains(t)) {
permanent.getSubtype(game).add(t);
}
}
}
break;
case ColorChangingEffects_5:
if (sublayer == SubLayer.NA) {
if (loseType.equals(LoseType.ALL)) {
if (loseType == LoseType.ALL) {
permanent.getColor(game).setBlack(false);
permanent.getColor(game).setGreen(false);
permanent.getColor(game).setBlue(false);
@ -148,11 +141,10 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
permanent.removeAllAbilities(source.getSourceId(), game);
break;
}
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

@ -69,7 +69,7 @@ public class SetToughnessSourceEffect extends ContinuousEffectImpl {
mageObject.getToughness().setValue(value);
return true;
} else {
if (Duration.Custom.equals(duration)) {
if (duration == Duration.Custom) {
discard();
}
}