From a0333eef8ff098e50c897a85fcd4756120149264 Mon Sep 17 00:00:00 2001 From: Marshall Date: Sun, 14 Jun 2015 18:06:04 -0400 Subject: [PATCH 1/6] Aquitect's Will implemented --- .../src/mage/sets/lorwyn/AquitectsWill.java | 131 ++++++++++++++++++ Mage/src/mage/counters/CounterType.java | 1 + 2 files changed, 132 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java diff --git a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java new file mode 100644 index 0000000000..9f700ffa37 --- /dev/null +++ b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java @@ -0,0 +1,131 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.lorwyn; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.mana.BlueManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetLandPermanent; + +/** + * + * @author ilcartographer + */ +public class AquitectsWill extends CardImpl { + private static final String rule = "land is an Island in addition to its other types for as long as it has a flood counter on it."; + + public AquitectsWill(UUID ownerId) { + super(ownerId, 52, "Aquitect's Will", Rarity.COMMON, new CardType[]{CardType.TRIBAL, CardType.SORCERY}, "{U}"); + this.expansionSetCode = "LRW"; + this.subtype.add("Merfolk"); + + // Put a flood counter on target land. That land is an Island in addition to its other types for as long as it has a flood counter on it. If you control a Merfolk, draw a card. + this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.FLOOD.createInstance())); + this.getSpellAbility().addTarget(new TargetLandPermanent()); + Effect effect = new AquitectsWillGainAbilityEffect( + new BlueManaAbility(), + Duration.Custom, rule); + this.getSpellAbility().addEffect(effect); + //this.getSpellAbility().addEffect(new AquitectsWillEffect()); + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new DrawCardSourceControllerEffect(1), + new PermanentsOnTheBattlefieldCondition(new FilterControlledCreaturePermanent("Merfolk", "Merfolk")), + "If you control a Merfolk, draw a card")); + } + + public AquitectsWill(final AquitectsWill card) { + super(card); + } + + @Override + public AquitectsWill copy() { + return new AquitectsWill(this); + } +} + +class AquitectsWillGainAbilityEffect extends GainAbilityTargetEffect { + + public AquitectsWillGainAbilityEffect(Ability ability, Duration duration, String rule) { + super(ability, duration, rule); + } + + public AquitectsWillGainAbilityEffect(final AquitectsWillGainAbilityEffect effect) { + super(effect); + } + + @Override + public boolean isInactive(Ability source, Game game) { + Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source)); + if (land != null && land.getCounters().getCount(CounterType.FLOOD) < 1) { + return true; + } + return false; + } + + @Override + public AquitectsWillGainAbilityEffect copy() { + return new AquitectsWillGainAbilityEffect(this); + } +} + +/* +class AquitectsWillEffect extends OneShotEffect { + + public AquitectsWillEffect() { + super(Outcome.DrawCard); + this.staticText = "If you control a Merfolk, draw a card."; + } + + public AquitectsWillEffect(final AquitectsWillEffect effect) { + super(effect); + } + + @Override + public AquitectsWillEffect copy() { + return new AquitectsWillEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } +}*/ diff --git a/Mage/src/mage/counters/CounterType.java b/Mage/src/mage/counters/CounterType.java index 00e2fe3b4b..e446016fa6 100644 --- a/Mage/src/mage/counters/CounterType.java +++ b/Mage/src/mage/counters/CounterType.java @@ -53,6 +53,7 @@ public enum CounterType { FADE("fade"), FATE("fate"), FEATHER("feather"), + FLOOD("flood"), FUSE("fuse"), HATCHLING("hatchling"), HOOFPRINT("hoofprint"), From 6d036a60851ef621a01b90e500a7b82ea48d251f Mon Sep 17 00:00:00 2001 From: Marshall Date: Sun, 14 Jun 2015 18:10:46 -0400 Subject: [PATCH 2/6] Removed unused code --- .../src/mage/sets/lorwyn/AquitectsWill.java | 31 ++++--------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java index 9f700ffa37..fa89587594 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java +++ b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java @@ -59,13 +59,17 @@ public class AquitectsWill extends CardImpl { this.subtype.add("Merfolk"); // Put a flood counter on target land. That land is an Island in addition to its other types for as long as it has a flood counter on it. If you control a Merfolk, draw a card. + // Add the flood counter to target land this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.FLOOD.createInstance())); this.getSpellAbility().addTarget(new TargetLandPermanent()); + + // Add the Flood counter effect Effect effect = new AquitectsWillGainAbilityEffect( new BlueManaAbility(), Duration.Custom, rule); this.getSpellAbility().addEffect(effect); - //this.getSpellAbility().addEffect(new AquitectsWillEffect()); + + // Draw if you control a Merfolk this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new DrawCardSourceControllerEffect(1), new PermanentsOnTheBattlefieldCondition(new FilterControlledCreaturePermanent("Merfolk", "Merfolk")), @@ -105,27 +109,4 @@ class AquitectsWillGainAbilityEffect extends GainAbilityTargetEffect { public AquitectsWillGainAbilityEffect copy() { return new AquitectsWillGainAbilityEffect(this); } -} - -/* -class AquitectsWillEffect extends OneShotEffect { - - public AquitectsWillEffect() { - super(Outcome.DrawCard); - this.staticText = "If you control a Merfolk, draw a card."; - } - - public AquitectsWillEffect(final AquitectsWillEffect effect) { - super(effect); - } - - @Override - public AquitectsWillEffect copy() { - return new AquitectsWillEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return false; - } -}*/ +} \ No newline at end of file From e5ef66a3cff7ed8a4c2d6554ec4eef0fd6b99b18 Mon Sep 17 00:00:00 2001 From: Marshall Date: Sun, 14 Jun 2015 19:24:31 -0400 Subject: [PATCH 3/6] Added an additional parameter to BecomesBasicLandTargetEffect to allow it to keep it's other land types; Updated Aquitect's Will to actually make the card an island, not just granting it the mana ability --- .../src/mage/sets/lorwyn/AquitectsWill.java | 18 ++++++++---------- .../BecomesBasicLandTargetEffect.java | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java index fa89587594..ab30e1e44f 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java +++ b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java @@ -33,6 +33,7 @@ import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.mana.BlueManaAbility; @@ -64,10 +65,7 @@ public class AquitectsWill extends CardImpl { this.getSpellAbility().addTarget(new TargetLandPermanent()); // Add the Flood counter effect - Effect effect = new AquitectsWillGainAbilityEffect( - new BlueManaAbility(), - Duration.Custom, rule); - this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addEffect(new AquitectsWillEffect(Duration.Custom, false, false, "Island")); // Draw if you control a Merfolk this.getSpellAbility().addEffect(new ConditionalOneShotEffect( @@ -86,13 +84,13 @@ public class AquitectsWill extends CardImpl { } } -class AquitectsWillGainAbilityEffect extends GainAbilityTargetEffect { +class AquitectsWillEffect extends BecomesBasicLandTargetEffect { - public AquitectsWillGainAbilityEffect(Ability ability, Duration duration, String rule) { - super(ability, duration, rule); + public AquitectsWillEffect(Duration duration, boolean chooseLandType, boolean loseType, String... landNames) { + super(duration, chooseLandType, loseType, landNames); } - public AquitectsWillGainAbilityEffect(final AquitectsWillGainAbilityEffect effect) { + public AquitectsWillEffect(final AquitectsWillEffect effect) { super(effect); } @@ -106,7 +104,7 @@ class AquitectsWillGainAbilityEffect extends GainAbilityTargetEffect { } @Override - public AquitectsWillGainAbilityEffect copy() { - return new AquitectsWillGainAbilityEffect(this); + public AquitectsWillEffect copy() { + return new AquitectsWillEffect(this); } } \ No newline at end of file diff --git a/Mage/src/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index 134bae4616..3cd7a1f11c 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -59,6 +59,7 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { protected boolean chooseLandType; protected ArrayList landTypes = new ArrayList(); + protected boolean loseOther; // loses all other abilities, card types, and creature types public BecomesBasicLandTargetEffect(Duration duration) { this(duration, true, new String[0]); @@ -69,10 +70,15 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { } public BecomesBasicLandTargetEffect(Duration duration, boolean chooseLandType, String... landNames) { + this(duration, chooseLandType, true, landNames); + } + + public BecomesBasicLandTargetEffect(Duration duration, boolean chooseLandType, boolean loseOther, String... landNames) { super(duration, Outcome.Detriment); this.landTypes.addAll(Arrays.asList(landNames)); this.chooseLandType = chooseLandType; this.staticText = setText(); + this.loseOther = loseOther; } @@ -105,6 +111,19 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { this.discard(); } } + + if(!loseOther) { + for (UUID targetPermanent : targetPointer.getTargets(game, source)) { + Permanent land = game.getPermanent(targetPermanent); + if (land != null) { + for(String type : land.getSubtype()) { + if(!landTypes.contains(type)) { + landTypes.add(type); + } + } + } + } + } } @Override From 5cf5990251d24397ebfb8c8c4b609126df3ed145 Mon Sep 17 00:00:00 2001 From: Marshall Date: Mon, 15 Jun 2015 20:48:56 -0400 Subject: [PATCH 4/6] Fertilid fix that actually lets the target player search library, not Fertilid's controller --- .../src/mage/sets/commander/Fertilid.java | 49 ++++++++++++++++++- .../search/SearchLibraryPutInPlayEffect.java | 4 +- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/commander/Fertilid.java b/Mage.Sets/src/mage/sets/commander/Fertilid.java index ea820f44fe..fd4d14ce21 100644 --- a/Mage.Sets/src/mage/sets/commander/Fertilid.java +++ b/Mage.Sets/src/mage/sets/commander/Fertilid.java @@ -36,12 +36,15 @@ import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterBasicLandCard; +import mage.game.Game; +import mage.players.Player; import mage.target.TargetPlayer; import mage.target.common.TargetCardInLibrary; @@ -61,7 +64,7 @@ public class Fertilid extends CardImpl { // Fertilid enters the battlefield with two +1/+1 counters on it. this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), "with two +1/+1 counters on it")); // {1}{G}, Remove a +1/+1 counter from Fertilid: Target player searches his or her library for a basic land card and puts it onto the battlefield tapped. Then that player shuffles his or her library. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true, true), new ManaCostsImpl("{1}{G}")); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new FertilidEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true, true), new ManaCostsImpl("{1}{G}")); ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance(1))); ability.addTarget(new TargetPlayer()); this.addAbility(ability); @@ -76,3 +79,47 @@ public class Fertilid extends CardImpl { return new Fertilid(this); } } + +class FertilidEffect extends SearchLibraryPutInPlayEffect { + + public FertilidEffect(TargetCardInLibrary target, boolean tapped, boolean forceShuffle) { + super(target, tapped, forceShuffle); + + this.staticText = "Target player searches his or her library for a basic land card and puts it onto the battlefield tapped. Then that player shuffles his or her library."; + } + + public FertilidEffect(final FertilidEffect effect) { + super(effect); + } + + @Override + public FertilidEffect copy() { + return new FertilidEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(targetPointer.getFirst(game, source)); + + if (player != null) { + if (player.searchLibrary(target, game)) { + if (target.getTargets().size() > 0) { + for (UUID cardId: target.getTargets()) { + Card card = player.getLibrary().getCard(cardId, game); + if (card != null) { + player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), tapped); + } + } + } + player.shuffleLibrary(game); + return true; + } + + if (forceShuffle) { + player.shuffleLibrary(game); + } + } + + return false; + } +} diff --git a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java index 01014677be..6776adcc8e 100644 --- a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java +++ b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java @@ -45,8 +45,8 @@ import mage.target.common.TargetCardInLibrary; */ public class SearchLibraryPutInPlayEffect extends SearchEffect { - private boolean tapped; - private boolean forceShuffle; + protected boolean tapped; + protected boolean forceShuffle; public SearchLibraryPutInPlayEffect(TargetCardInLibrary target) { this(target, false, true, Outcome.PutCardInPlay); From 823002984afeb1ce9f6156dc5ff73d7f218eed57 Mon Sep 17 00:00:00 2001 From: Marshall Date: Mon, 15 Jun 2015 21:06:19 -0400 Subject: [PATCH 5/6] Discarding the effect once the land has no more flood counters --- Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java index ab30e1e44f..7aeb233286 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java +++ b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java @@ -98,8 +98,10 @@ class AquitectsWillEffect extends BecomesBasicLandTargetEffect { public boolean isInactive(Ability source, Game game) { Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source)); if (land != null && land.getCounters().getCount(CounterType.FLOOD) < 1) { + this.discard(); return true; } + return false; } From 27880a59b4e18c81094a1db999fdc550be59f415 Mon Sep 17 00:00:00 2001 From: Marshall Date: Mon, 15 Jun 2015 21:09:12 -0400 Subject: [PATCH 6/6] Removed unused imports --- Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java index 7aeb233286..b78e153907 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java +++ b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java @@ -31,12 +31,9 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.decorator.ConditionalOneShotEffect; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect; -import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; -import mage.abilities.mana.BlueManaAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration;