From 66dc07e8721ea9cd52a1ae5bc5217a565f5519de Mon Sep 17 00:00:00 2001 From: Plopman Date: Sat, 30 Mar 2013 19:09:17 +0100 Subject: [PATCH] Added land cycling Ability --- .../keyword/BasicLandcyclingAbility.java | 16 +---- .../abilities/keyword/CyclingAbility.java | 52 ++++++----------- .../keyword/ForestcyclingAbility.java | 58 +++++++++++++++++++ .../keyword/IslandcyclingAbility.java | 58 +++++++++++++++++++ .../keyword/MountaincyclingAbility.java | 58 +++++++++++++++++++ .../keyword/PlainscyclingAbility.java | 19 ++---- .../keyword/SwampcyclingAbility.java | 58 +++++++++++++++++++ Utils/keywords.txt | 5 ++ 8 files changed, 262 insertions(+), 62 deletions(-) create mode 100644 Mage/src/mage/abilities/keyword/ForestcyclingAbility.java create mode 100644 Mage/src/mage/abilities/keyword/IslandcyclingAbility.java create mode 100644 Mage/src/mage/abilities/keyword/MountaincyclingAbility.java create mode 100644 Mage/src/mage/abilities/keyword/SwampcyclingAbility.java diff --git a/Mage/src/mage/abilities/keyword/BasicLandcyclingAbility.java b/Mage/src/mage/abilities/keyword/BasicLandcyclingAbility.java index 6a43beb530..a46f817189 100644 --- a/Mage/src/mage/abilities/keyword/BasicLandcyclingAbility.java +++ b/Mage/src/mage/abilities/keyword/BasicLandcyclingAbility.java @@ -28,24 +28,19 @@ package mage.abilities.keyword; -import mage.Constants.Zone; -import mage.abilities.ActivatedAbilityImpl; -import mage.abilities.costs.common.DiscardSourceCost; import mage.abilities.costs.mana.ManaCosts; -import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; import mage.filter.common.FilterBasicLandCard; -import mage.target.common.TargetCardInLibrary; /** * * @author Loki */ -public class BasicLandcyclingAbility extends ActivatedAbilityImpl{ +public class BasicLandcyclingAbility extends CyclingAbility{ private static final FilterBasicLandCard filter = new FilterBasicLandCard(); + private static final String text = "Basic landcycling"; public BasicLandcyclingAbility(ManaCosts costs) { - super(Zone.HAND, new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter)), costs); - this.addCost(new DiscardSourceCost()); + super(costs, filter, text); } public BasicLandcyclingAbility(final BasicLandcyclingAbility ability) { @@ -56,9 +51,4 @@ public class BasicLandcyclingAbility extends ActivatedAbilityImpl { private Cost cost; + private String text; public CyclingAbility(Cost cost) { - super(Zone.HAND, new CycleEffect(), cost); + super(Zone.HAND, new DrawCardControllerEffect(1), cost); this.addCost(new DiscardSourceCost()); this.cost = cost; + this.text = "Cycling"; + } + + public CyclingAbility(Cost cost, FilterCard filter, String text){ + super(Zone.HAND, new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter)), cost); + this.addCost(new DiscardSourceCost()); + this.cost = cost; + this.text = text; } public CyclingAbility(final CyclingAbility ability) { super(ability); this.cost = ability.cost; + this.text = ability.text; } @Override @@ -66,39 +75,14 @@ public class CyclingAbility extends ActivatedAbilityImpl { @Override public String getRule() { - String rule = ""; + String rule; if(cost instanceof ManaCosts){ - rule = "Cycling " + cost.getText() + " (" + super.getRule() + ")"; + rule = this.text + " " + cost.getText() + " (" + super.getRule() + ")"; } else{ - rule = "Cycling-" + cost.getText() + " (" + super.getRule() + ")"; + rule = this.text + "-" + cost.getText() + " (" + super.getRule() + ")"; } return rule; } } - -class CycleEffect extends OneShotEffect { - - public CycleEffect() { - super(Outcome.DrawCard); - staticText = "Draw a card"; - } - - public CycleEffect(final CycleEffect effect) { - super(effect); - } - - @Override - public CycleEffect copy() { - return new CycleEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - player.drawCards(1, game); - return true; - } - -} \ No newline at end of file diff --git a/Mage/src/mage/abilities/keyword/ForestcyclingAbility.java b/Mage/src/mage/abilities/keyword/ForestcyclingAbility.java new file mode 100644 index 0000000000..c276c2be1d --- /dev/null +++ b/Mage/src/mage/abilities/keyword/ForestcyclingAbility.java @@ -0,0 +1,58 @@ +/* + * 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.abilities.keyword; + +import mage.abilities.costs.mana.ManaCosts; +import mage.filter.common.FilterLandCard; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author Plopman + */ +public class ForestcyclingAbility extends CyclingAbility{ + private static final FilterLandCard filter = new FilterLandCard("Forest card"); + private static final String text = "Forestcycling"; + static{ + filter.add(new SubtypePredicate("Forest")); + } + + public ForestcyclingAbility(ManaCosts costs) { + super(costs, filter, text); + } + + public ForestcyclingAbility(final ForestcyclingAbility ability) { + super(ability); + } + + @Override + public ForestcyclingAbility copy() { + return new ForestcyclingAbility(this); + } +} diff --git a/Mage/src/mage/abilities/keyword/IslandcyclingAbility.java b/Mage/src/mage/abilities/keyword/IslandcyclingAbility.java new file mode 100644 index 0000000000..1fefefe029 --- /dev/null +++ b/Mage/src/mage/abilities/keyword/IslandcyclingAbility.java @@ -0,0 +1,58 @@ +/* + * 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.abilities.keyword; + +import mage.abilities.costs.mana.ManaCosts; +import mage.filter.common.FilterLandCard; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author Plopman + */ +public class IslandcyclingAbility extends CyclingAbility{ + private static final FilterLandCard filter = new FilterLandCard("Island card"); + private static final String text = "Islandcycling"; + static{ + filter.add(new SubtypePredicate("Island")); + } + + public IslandcyclingAbility(ManaCosts costs) { + super(costs, filter, text); + } + + public IslandcyclingAbility(final IslandcyclingAbility ability) { + super(ability); + } + + @Override + public IslandcyclingAbility copy() { + return new IslandcyclingAbility(this); + } +} diff --git a/Mage/src/mage/abilities/keyword/MountaincyclingAbility.java b/Mage/src/mage/abilities/keyword/MountaincyclingAbility.java new file mode 100644 index 0000000000..b17facd139 --- /dev/null +++ b/Mage/src/mage/abilities/keyword/MountaincyclingAbility.java @@ -0,0 +1,58 @@ +/* + * 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.abilities.keyword; + +import mage.abilities.costs.mana.ManaCosts; +import mage.filter.common.FilterLandCard; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author Plopman + */ +public class MountaincyclingAbility extends CyclingAbility{ + private static final FilterLandCard filter = new FilterLandCard("Mountain card"); + private static final String text = "Mountaincycling"; + static{ + filter.add(new SubtypePredicate("Mountain")); + } + + public MountaincyclingAbility(ManaCosts costs) { + super(costs, filter, text); + } + + public MountaincyclingAbility(final MountaincyclingAbility ability) { + super(ability); + } + + @Override + public MountaincyclingAbility copy() { + return new MountaincyclingAbility(this); + } +} diff --git a/Mage/src/mage/abilities/keyword/PlainscyclingAbility.java b/Mage/src/mage/abilities/keyword/PlainscyclingAbility.java index f042f3f5a7..fdc23e285d 100644 --- a/Mage/src/mage/abilities/keyword/PlainscyclingAbility.java +++ b/Mage/src/mage/abilities/keyword/PlainscyclingAbility.java @@ -28,29 +28,23 @@ package mage.abilities.keyword; -import mage.Constants.Zone; -import mage.abilities.ActivatedAbilityImpl; -import mage.abilities.costs.common.DiscardSourceCost; import mage.abilities.costs.mana.ManaCosts; -import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; import mage.filter.common.FilterLandCard; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.target.common.TargetCardInLibrary; /** * * @author Loki */ -public class PlainscyclingAbility extends ActivatedAbilityImpl{ +public class PlainscyclingAbility extends CyclingAbility{ private static final FilterLandCard filter = new FilterLandCard("Plains card"); - - static { + private static final String text = "Plainscycling"; + static{ filter.add(new SubtypePredicate("Plains")); } public PlainscyclingAbility(ManaCosts costs) { - super(Zone.HAND, new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter)), costs); - this.addCost(new DiscardSourceCost()); + super(costs, filter, text); } public PlainscyclingAbility(final PlainscyclingAbility ability) { @@ -61,9 +55,4 @@ public class PlainscyclingAbility extends ActivatedAbilityImpl