Rename AnyColorOpponentLandsProduceManaAbility to AnyColorLandsProduceManaAbility and give the controller of land to it as a parameter. Implement card: Harvester Druid

This commit is contained in:
LoneFox 2015-12-31 22:34:58 +02:00
parent b80a7a1446
commit bbbfd9f5b2
6 changed files with 96 additions and 27 deletions

View file

@ -28,10 +28,11 @@
package mage.sets.conflux;
import java.util.UUID;
import mage.abilities.mana.AnyColorOpponentLandsProduceManaAbility;
import mage.abilities.mana.AnyColorLandsProduceManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
/**
*
@ -44,7 +45,7 @@ public class ExoticOrchard extends CardImpl {
this.expansionSetCode = "CON";
// {T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
this.addAbility(new AnyColorOpponentLandsProduceManaAbility());
this.addAbility(new AnyColorLandsProduceManaAbility(TargetController.OPPONENT));
}
public ExoticOrchard(final ExoticOrchard card) {

View file

@ -29,10 +29,11 @@ package mage.sets.fifthdawn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.mana.AnyColorOpponentLandsProduceManaAbility;
import mage.abilities.mana.AnyColorLandsProduceManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
/**
*
@ -50,7 +51,7 @@ public class SylvokExplorer extends CardImpl {
this.toughness = new MageInt(1);
// {T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
this.addAbility(new AnyColorOpponentLandsProduceManaAbility());
this.addAbility(new AnyColorLandsProduceManaAbility(TargetController.OPPONENT));
}
public SylvokExplorer(final SylvokExplorer card) {

View file

@ -0,0 +1,64 @@
/*
* 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.judgment;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.mana.AnyColorLandsProduceManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
/**
*
* @author LoneFox
*/
public class HarvesterDruid extends CardImpl {
public HarvesterDruid(UUID ownerId) {
super(ownerId, 120, "Harvester Druid", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.expansionSetCode = "JUD";
this.subtype.add("Human");
this.subtype.add("Druid");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {tap}: Add to your mana pool one mana of any color that a land you control could produce.
this.addAbility(new AnyColorLandsProduceManaAbility(TargetController.YOU));
}
public HarvesterDruid(final HarvesterDruid card) {
super(card);
}
@Override
public HarvesterDruid copy() {
return new HarvesterDruid(this);
}
}

View file

@ -28,10 +28,11 @@
package mage.sets.ninthedition;
import java.util.UUID;
import mage.abilities.mana.AnyColorOpponentLandsProduceManaAbility;
import mage.abilities.mana.AnyColorLandsProduceManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
/**
*
@ -44,7 +45,7 @@ public class FellwarStone extends CardImpl {
this.expansionSetCode = "9ED";
// {T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
this.addAbility(new AnyColorOpponentLandsProduceManaAbility());
this.addAbility(new AnyColorLandsProduceManaAbility(TargetController.OPPONENT));
}
public FellwarStone(final FellwarStone card) {

View file

@ -29,10 +29,11 @@ package mage.sets.planeshift;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.mana.AnyColorOpponentLandsProduceManaAbility;
import mage.abilities.mana.AnyColorLandsProduceManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
/**
*
@ -50,7 +51,7 @@ public class QuirionExplorer extends CardImpl {
this.toughness = new MageInt(1);
// {T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
this.addAbility(new AnyColorOpponentLandsProduceManaAbility());
this.addAbility(new AnyColorLandsProduceManaAbility(TargetController.OPPONENT));
}
public QuirionExplorer(final QuirionExplorer card) {

View file

@ -51,41 +51,42 @@ import mage.players.Player;
* @author LevelX2
*/
public class AnyColorOpponentLandsProduceManaAbility extends ManaAbility {
public class AnyColorLandsProduceManaAbility extends ManaAbility {
public AnyColorOpponentLandsProduceManaAbility() {
super(Zone.BATTLEFIELD, new AnyColorOpponentLandsProduceManaEffect(),new TapSourceCost());
public AnyColorLandsProduceManaAbility(TargetController targetController) {
super(Zone.BATTLEFIELD, new AnyColorLandsProduceManaEffect(targetController), new TapSourceCost());
}
public AnyColorOpponentLandsProduceManaAbility(final AnyColorOpponentLandsProduceManaAbility ability) {
public AnyColorLandsProduceManaAbility(final AnyColorLandsProduceManaAbility ability) {
super(ability);
}
@Override
public AnyColorOpponentLandsProduceManaAbility copy() {
return new AnyColorOpponentLandsProduceManaAbility(this);
public AnyColorLandsProduceManaAbility copy() {
return new AnyColorLandsProduceManaAbility(this);
}
@Override
public List<Mana> getNetMana(Game game) {
return ((AnyColorOpponentLandsProduceManaEffect)getEffects().get(0)).getNetMana(game, this);
return ((AnyColorLandsProduceManaEffect)getEffects().get(0)).getNetMana(game, this);
}
}
class AnyColorOpponentLandsProduceManaEffect extends ManaEffect {
class AnyColorLandsProduceManaEffect extends ManaEffect {
private static final FilterPermanent filter = new FilterLandPermanent();
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
private final FilterPermanent filter;
public AnyColorOpponentLandsProduceManaEffect() {
public AnyColorLandsProduceManaEffect(TargetController targetController) {
super();
staticText = "Add to your mana pool one mana of any color that a land an opponent controls could produce";
filter = new FilterLandPermanent();
filter.add(new ControllerPredicate(targetController));
String text = targetController == TargetController.OPPONENT ? "an opponent controls" : "you control";
staticText = "Add to your mana pool one mana of any color that a land " + text + " could produce";
}
public AnyColorOpponentLandsProduceManaEffect(final AnyColorOpponentLandsProduceManaEffect effect) {
public AnyColorLandsProduceManaEffect(final AnyColorLandsProduceManaEffect effect) {
super(effect);
this.filter = effect.filter.copy();
}
@Override
@ -194,7 +195,7 @@ class AnyColorOpponentLandsProduceManaEffect extends ManaEffect {
}
@Override
public AnyColorOpponentLandsProduceManaEffect copy() {
return new AnyColorOpponentLandsProduceManaEffect(this);
public AnyColorLandsProduceManaEffect copy() {
return new AnyColorLandsProduceManaEffect(this);
}
}