Merge pull request #3066 from ingmargoudt/cleanups

Cleanups
This commit is contained in:
LevelX2 2017-04-06 23:26:52 +02:00 committed by GitHub
commit 22e376699e
35 changed files with 97 additions and 104 deletions

View file

@ -13,7 +13,9 @@ import mage.watchers.common.CastFromHandWatcher;
*
* @author Loki
*/
public class CastFromHandSourceCondition implements Condition {
public enum CastFromHandSourceCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -7,7 +7,9 @@ import mage.players.Player;
import java.util.UUID;
public class MoreCardsInHandThanOpponentsCondition implements Condition {
public enum MoreCardsInHandThanOpponentsCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -28,21 +28,21 @@
package mage.abilities.condition.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public class OpponentHasMoreLifeCondition implements Condition {
public enum OpponentHasMoreLifeCondition implements Condition {
public OpponentHasMoreLifeCondition() {
}
instance;
@Override
public boolean apply(Game game, Ability source) {

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;
}
}