From 38b2f492a2e83de2fd4f6c25343b2d9a216e72e1 Mon Sep 17 00:00:00 2001 From: jeffwadsworth <> Date: Thu, 18 Feb 2021 22:22:39 -0600 Subject: [PATCH] - Fixed #7597 --- Mage.Sets/src/mage/cards/a/AquitectsWill.java | 57 +++++++++++++++---- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AquitectsWill.java b/Mage.Sets/src/mage/cards/a/AquitectsWill.java index 661e2e50f7..e7a5d8e536 100644 --- a/Mage.Sets/src/mage/cards/a/AquitectsWill.java +++ b/Mage.Sets/src/mage/cards/a/AquitectsWill.java @@ -1,11 +1,12 @@ package mage.cards.a; +import java.util.List; +import java.util.Set; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; -import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -17,6 +18,11 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetLandPermanent; import java.util.UUID; +import java.util.stream.Collectors; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.Effect; +import mage.abilities.mana.BlueManaAbility; /** * @author ilcartographer @@ -54,29 +60,58 @@ public final class AquitectsWill extends CardImpl { } } -class AquitectsWillEffect extends BecomesBasicLandTargetEffect { +class AquitectsWillEffect extends ContinuousEffectImpl { AquitectsWillEffect() { - super(Duration.Custom, false, false, SubType.ISLAND); + super(Duration.EndOfGame, Outcome.Benefit); staticText = "That land is an Island in addition to its other types for as long as it has a flood counter on it"; } - private AquitectsWillEffect(final AquitectsWillEffect effect) { + AquitectsWillEffect(final AquitectsWillEffect effect) { super(effect); } @Override - public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source)); - if (land == null || land.getCounters(game).getCount(CounterType.FLOOD) < 1) { - this.discard(); - return false; - } - return super.apply(layer, sublayer, source, game); + public boolean apply(Game game, Ability source) { + return false; } @Override public AquitectsWillEffect copy() { return new AquitectsWillEffect(this); } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source)); + if (land == null + || land.getCounters(game).getCount(CounterType.FLOOD) < 1) { + discard(); + return false; + } + // The land is an island intrinsically so the ability is added at layer 4, not layer 6 + if (land.getCounters(game).getCount(CounterType.FLOOD) > 0) { + switch (layer) { + case TypeChangingEffects_4: + land.addSubType(game, SubType.ISLAND); + land.addAbility(new BlueManaAbility(), source.getSourceId(), game); + break; + } + } + return true; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.TypeChangingEffects_4; + } + + @Override + public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) { + return allEffectsInLayer + .stream() + .filter(effect -> effect.getDependencyTypes().contains(DependencyType.BecomeIsland)) + .map(Effect::getId) + .collect(Collectors.toSet()); + } }