This commit is contained in:
jeffwadsworth 2021-02-18 22:22:39 -06:00
parent 0e0ace14b5
commit 38b2f492a2

View file

@ -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());
}
}