added addCardType to MageObject

This commit is contained in:
ingmargoudt 2017-04-05 15:36:07 +02:00
parent cf6fe27f7d
commit 8b90f87af6
52 changed files with 72 additions and 72 deletions

View file

@ -138,7 +138,7 @@ public interface MageObject extends MageItem, Serializable {
}
default void addCardType(CardType cardType) {
getCardType().add(cardType);
addCardType(cardType);
}
/**
@ -186,4 +186,7 @@ public interface MageObject extends MageItem, Serializable {
return false;
}
default void addCardTypes(EnumSet<CardType> cardType){
getCardType().addAll(cardType);
}
}

View file

@ -139,7 +139,7 @@ class LicidContinuousEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
licid.getCardType().clear();
licid.getCardType().add(CardType.ENCHANTMENT);
licid.addCardType(CardType.ENCHANTMENT);
licid.getSubtype(game).clear();
licid.getSubtype(game).add("Aura");
break;

View file

@ -122,7 +122,7 @@ public class CopyEffect extends ContinuousEffectImpl {
permanent.getManaCost().add(copyFromObject.getManaCost());
permanent.getCardType().clear();
for (CardType type : copyFromObject.getCardType()) {
permanent.getCardType().add(type);
permanent.addCardType(type);
}
permanent.getSubtype(game).clear();
for (String type : copyFromObject.getSubtype(game)) {

View file

@ -28,7 +28,7 @@ public class CopyTokenEffect extends ContinuousEffectImpl {
permanent.getColor(game).setColor(token.getColor(game));
permanent.getCardType().clear();
for (CardType type: token.getCardType()) {
permanent.getCardType().add(type);
permanent.addCardType(type);
}
permanent.getSubtype(game).clear();
for (String type: token.getSubtype(game)) {

View file

@ -190,10 +190,10 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect {
CardUtil.copyTo(token).from(copyFrom); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer)
applier.apply(game, token);
if (becomesArtifact) {
token.getCardType().add(CardType.ARTIFACT);
token.addCardType(CardType.ARTIFACT);
}
if (additionalCardType != null && !token.getCardType().contains(additionalCardType)) {
token.getCardType().add(additionalCardType);
token.addCardType(additionalCardType);
}
if (gainsHaste) {
token.addAbility(HasteAbility.getInstance());

View file

@ -60,7 +60,7 @@ public class AddCardTypeAttachedEffect extends ContinuousEffectImpl {
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent target = game.getPermanent(equipment.getAttachedTo());
if (target != null && !target.getCardType().contains(addedCardType))
target.getCardType().add(addedCardType);
target.addCardType(addedCardType);
}
return true;
}

View file

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

View file

@ -69,7 +69,7 @@ public class AddCardTypeTargetEffect extends ContinuousEffectImpl {
Permanent target = game.getPermanent(targetId);
if (target != null) {
if (!target.getCardType().contains(addedCardType)) {
target.getCardType().add(addedCardType);
target.addCardType(addedCardType);
}
result = true;
}

View file

@ -145,7 +145,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
case TypeChangingEffects_4:
// Attention: Cards like Unstable Frontier that use this class do not give the "Basic" supertype to the target
if (!land.isLand()) {
land.getCardType().add(CardType.LAND);
land.addCardType(CardType.LAND);
}
if (loseOther) {
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects

View file

@ -79,7 +79,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.getCardType().add(t);
permanent.addCardType(t);
}
}
}

View file

@ -93,7 +93,7 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
break;
}
for (CardType t : token.getCardType()) {
permanent.getCardType().add(t);
permanent.addCardType(t);
}
// sub type

View file

@ -109,7 +109,7 @@ public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends Co
break;
}
for (CardType cardType : token.getCardType()) {
permanentAttachedTo.getCardType().add(cardType);
permanentAttachedTo.addCardType(cardType);
}
// sub type

View file

@ -116,7 +116,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl implements
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.getCardType().add(t);
permanent.addCardType(t);
}
}
}

View file

@ -103,7 +103,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
if (!token.getCardType().isEmpty()) {
for (CardType t : token.getCardType()) {
if (!permanent.getCardType().contains(t)) {
permanent.getCardType().add(t);
permanent.addCardType(t);
}
}
}

View file

@ -109,7 +109,7 @@ public class BecomesFaceDownCreatureAllEffect extends ContinuousEffectImpl imple
permanent.setName("");
permanent.getSuperType().clear();
permanent.getCardType().clear();
permanent.getCardType().add(CardType.CREATURE);
permanent.addCardType(CardType.CREATURE);
permanent.getSubtype(game).clear();
permanent.getManaCost().clear();
break;

View file

@ -165,7 +165,7 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
permanent.setName("");
permanent.getSuperType().clear();
permanent.getCardType().clear();
permanent.getCardType().add(CardType.CREATURE);
permanent.addCardType(CardType.CREATURE);
permanent.getSubtype(game).clear();
break;
case ColorChangingEffects_5:

View file

@ -151,12 +151,12 @@ public class BestowAbility extends SpellAbility {
if (basicObject != null) {
basicObject.getSubtype(null).remove("Aura");
if (!basicObject.isCreature()) {
basicObject.getCardType().add(CardType.CREATURE);
basicObject.addCardType(CardType.CREATURE);
}
}
permanent.getSubtype(null).remove("Aura");
if (!permanent.isCreature()) {
permanent.getCardType().add(CardType.CREATURE);
permanent.addCardType(CardType.CREATURE);
}
}

View file

@ -299,7 +299,7 @@ public class MorphAbility extends StaticAbility implements AlternativeSourceCost
mageObject.getColor(null).setColor(new ObjectColor());
mageObject.setName("");
mageObject.getCardType().clear();
mageObject.getCardType().add(CardType.CREATURE);
mageObject.addCardType(CardType.CREATURE);
mageObject.getSubtype(null).clear();
mageObject.getSuperType().clear();
mageObject.getManaCost().clear();

View file

@ -77,7 +77,7 @@ public class TransformAbility extends SimpleStaticAbility {
permanent.getManaCost().add(sourceCard.getManaCost());
permanent.getCardType().clear();
for (CardType type : sourceCard.getCardType()) {
permanent.getCardType().add(type);
permanent.addCardType(type);
}
permanent.getSubtype(game).clear();
for (String type : sourceCard.getSubtype(game)) {

View file

@ -253,14 +253,14 @@ public class Spell extends StackObjImpl implements Card {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null && permanent instanceof PermanentCard) {
permanent.setSpellAbility(ability); // otherwise spell ability without bestow will be set
card.getCardType().add(CardType.CREATURE);
card.addCardType(CardType.CREATURE);
card.getSubtype(game).remove("Aura");
}
}
return ability.resolve(game);
}
if (bestow) {
card.getCardType().add(CardType.CREATURE);
card.addCardType(CardType.CREATURE);
}
return false;
}
@ -270,7 +270,7 @@ public class Spell extends StackObjImpl implements Card {
if (controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null)) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null && permanent instanceof PermanentCard) {
((PermanentCard) permanent).getCard().getCardType().add(CardType.CREATURE);
((PermanentCard) permanent).getCard().addCardType(CardType.CREATURE);
((PermanentCard) permanent).getCard().getSubtype(game).remove("Aura");
return true;
}

View file

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

View file

@ -93,7 +93,7 @@ public class CopyTokenFunction implements Function<Token, Card> {
target.getManaCost().add(sourceObj.getManaCost());
target.getCardType().clear();
for (CardType type : sourceObj.getCardType()) {
target.getCardType().add(type);
target.addCardType(type);
}
target.getSubtype(null).clear();
for (String type : sourceObj.getSubtype(null)) {