This commit is contained in:
jeffwadsworth 2020-02-06 17:47:08 -06:00
parent b75a5d86b1
commit d6c2f031d0
28 changed files with 813 additions and 650 deletions

View file

@ -43,12 +43,15 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
if (permanent != null) {
switch (layer) {
case AbilityAddingRemovingEffects_6:
case TypeChangingEffects_4:
// lands intrictically have the mana ability associated with their type, so added here in layer 4
permanent.getSubtype(game).removeAll(SubType.getLandTypes());
permanent.getSubtype(game).addAll(landTypes);
permanent.removeAllAbilities(source.getSourceId(), game);
for (SubType landType : landTypes) {
switch (landType) {
case SWAMP:
if (permanent.hasSubtype(SubType.SWAMP, game)) { // type can be removed by other effect with newer timestamp, so no ability adding
if (permanent.hasSubtype(SubType.SWAMP, game)) {
permanent.addAbility(new BlackManaAbility(), source.getSourceId(), game);
}
break;
@ -75,11 +78,6 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
}
}
break;
case TypeChangingEffects_4:
// subtypes are all removed by changing the subtype to a land type.
permanent.getSubtype(game).removeAll(SubType.getLandTypes());
permanent.getSubtype(game).addAll(landTypes);
break;
}
return true;
}
@ -89,7 +87,7 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.TypeChangingEffects_4;
return layer == Layer.TypeChangingEffects_4;
}
private String setText() {

View file

@ -112,7 +112,8 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
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
// 305.7 Note that this doesn't remove any abilities
// that were granted to the land by other effects
// So the ability removing has to be done before Layer 6
land.removeAllAbilities(source.getSourceId(), game);
// 305.7
@ -127,8 +128,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
}
}
}
break;
case AbilityAddingRemovingEffects_6:
// add intrinsic land abilities here not in layer 6
for (SubType landType : landTypesToAdd) {
switch (landType) {
case SWAMP:
@ -157,7 +157,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.TypeChangingEffects_4;
return layer == Layer.TypeChangingEffects_4;
}
private String setText() {

View file

@ -25,15 +25,18 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
private boolean loseTypes = false;
protected boolean loseName = false;
public BecomesCreatureAllEffect(Token token, String theyAreStillType, FilterPermanent filter, Duration duration, boolean loseColor) {
public BecomesCreatureAllEffect(Token token, String theyAreStillType,
FilterPermanent filter, Duration duration, boolean loseColor) {
this(token, theyAreStillType, filter, duration, loseColor, false, false);
}
public BecomesCreatureAllEffect(Token token, String theyAreStillType, FilterPermanent filter, Duration duration, boolean loseColor, boolean loseName) {
public BecomesCreatureAllEffect(Token token, String theyAreStillType,
FilterPermanent filter, Duration duration, boolean loseColor, boolean loseName) {
this(token, theyAreStillType, filter, duration, loseColor, loseName, false);
}
public BecomesCreatureAllEffect(Token token, String theyAreStillType, FilterPermanent filter, Duration duration, boolean loseColor, boolean loseName, boolean loseTypes) {
public BecomesCreatureAllEffect(Token token, String theyAreStillType,
FilterPermanent filter, Duration duration, boolean loseColor, boolean loseName, boolean loseTypes) {
super(duration, Outcome.BecomeCreature);
this.token = token;
this.theyAreStillType = theyAreStillType;
@ -57,7 +60,8 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
public void init(Ability source, Game game) {
super.init(source, game);
if (this.affectedObjectsSet) {
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
for (Permanent perm : game.getBattlefield().getActivePermanents(
filter, source.getControllerId(), source.getSourceId(), game)) {
affectedObjectList.add(new MageObjectReference(perm, game));
}
}
@ -76,7 +80,8 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl {
affectedPermanents.add(ref.getPermanent(game));
}
} else {
affectedPermanents = new HashSet<>(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game));
affectedPermanents = new HashSet<>(game.getBattlefield()
.getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game));
}
for (Permanent permanent : affectedPermanents) {

View file

@ -30,6 +30,13 @@ public class BecomesCreatureAttachedEffect extends ContinuousEffectImpl {
this.loseType = loseType;
staticText = text;
}
public BecomesCreatureAttachedEffect(Token token, String text, Duration duration, LoseType loseType, Outcome outcome) {
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, outcome);
this.token = token;
this.loseType = loseType;
staticText = text;
}
public BecomesCreatureAttachedEffect(final BecomesCreatureAttachedEffect effect) {
super(effect);