Added land cycling Ability

This commit is contained in:
Plopman 2013-03-30 19:09:17 +01:00
parent 4212e5cfb6
commit 66dc07e872
8 changed files with 262 additions and 62 deletions

View file

@ -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<BasicLandcyclingAbility>{
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<BasicLandcycli
public BasicLandcyclingAbility copy() {
return new BasicLandcyclingAbility(this);
}
@Override
public String getRule() {
return "Basic landcycling " + super.getRule();
}
}

View file

@ -28,16 +28,15 @@
package mage.abilities.keyword;
import mage.Constants.Outcome;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.DiscardSourceCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.OneShotEffect;
import mage.game.Game;
import mage.players.Player;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.filter.FilterCard;
import mage.target.common.TargetCardInLibrary;
/**
@ -47,16 +46,26 @@ import mage.players.Player;
public class CyclingAbility extends ActivatedAbilityImpl<CyclingAbility> {
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<CyclingAbility> {
@Override
public String getRule() {
String rule = "";
String rule;
if(cost instanceof ManaCosts){
rule = "Cycling " + cost.getText() + " <i>(" + super.getRule() + ")</i>";
rule = this.text + " " + cost.getText() + " <i>(" + super.getRule() + ")</i>";
}
else{
rule = "Cycling-" + cost.getText() + " <i>(" + super.getRule() + ")</i>";
rule = this.text + "-" + cost.getText() + " <i>(" + super.getRule() + ")</i>";
}
return rule;
}
}
class CycleEffect extends OneShotEffect<CycleEffect> {
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;
}
}

View file

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

View file

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

View file

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

View file

@ -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<PlainscyclingAbility>{
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<PlainscyclingAbil
public PlainscyclingAbility copy() {
return new PlainscyclingAbility(this);
}
@Override
public String getRule() {
return "Plainscycling " + super.getRule();
}
}

View file

@ -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 SwampcyclingAbility extends CyclingAbility{
private static final FilterLandCard filter = new FilterLandCard("Swamp card");
private static final String text = "Swampcycling";
static{
filter.add(new SubtypePredicate("Swamp"));
}
public SwampcyclingAbility(ManaCosts costs) {
super(costs, filter, text);
}
public SwampcyclingAbility(final SwampcyclingAbility ability) {
super(ability);
}
@Override
public SwampcyclingAbility copy() {
return new SwampcyclingAbility(this);
}
}

View file

@ -4,6 +4,11 @@ Bushido|number|
Dredge|number|
Soulshift|number|
Basic landcycling|cost|
Forestcycling|cost|
Islandcycling|cost|
Mountaincycling|cost|
Plainscycling|cost|
Swampcycling|cost|
Cycling|cost|
Cumulative upkeep|cost|
Level up|cost|