don't need MillTarget, already have this one

This commit is contained in:
Loki 2012-07-31 21:20:48 +12:00
parent 90ab9a759c
commit 42d925e008
5 changed files with 177 additions and 94 deletions

View file

@ -30,13 +30,13 @@ package mage.sets.fifthedition;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.cards.CardImpl;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.Constants.Zone;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.MillTargetEffect;
import mage.target.TargetPlayer;
/**
@ -50,7 +50,7 @@ public class Millstone extends CardImpl<Millstone> {
this.expansionSetCode = "5ED";
// {2}, {tap}: Target player puts the top two cards of his or her library into his or her graveyard.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MillTargetEffect(2), new GenericManaCost(2));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(2), new GenericManaCost(2));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPlayer());
this.addAbility(ability);

View file

@ -0,0 +1,52 @@
/*
* 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.futuresight;
import java.util.UUID;
/**
*
* @author Loki
*/
public class GravenCairns extends mage.sets.shadowmoor.GravenCairns {
public GravenCairns(UUID ownerId) {
super(ownerId);
this.cardNumber = 175;
this.expansionSetCode = "FUT";
}
public GravenCairns(final GravenCairns card) {
super(card);
}
@Override
public GravenCairns copy() {
return new GravenCairns(this);
}
}

View file

@ -35,7 +35,7 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.effects.common.MillTargetEffect;
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
@ -68,7 +68,7 @@ public class DrownerOfSecrets extends CardImpl<DrownerOfSecrets> {
this.toughness = new MageInt(3);
// Tap an untapped Merfolk you control: Target player puts the top card of his or her library into his or her graveyard.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new MillTargetEffect(1), new TapTargetCost(new TargetControlledPermanent(filter)));
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(1), new TapTargetCost(new TargetControlledPermanent(filter)));
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}

View file

@ -0,0 +1,121 @@
/*
* 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.shadowmoor;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Mana;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.mana.BasicManaAbility;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
/**
*
* @author Loki
*/
public class GravenCairns extends CardImpl<GravenCairns> {
public GravenCairns(UUID ownerId) {
super(ownerId, 272, "Graven Cairns", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "SHM";
// {tap}: Add {1} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {BR}, {tap}: Add {B}{B}, {B}{R}, or {R}{R} to your mana pool.
this.addAbility(new GravenCairnsFirstManaAbility());
this.addAbility(new GravenCairnsSecondManaAbility());
this.addAbility(new GravenCairnsThirdManaAbility());
}
public GravenCairns(final GravenCairns card) {
super(card);
}
@Override
public GravenCairns copy() {
return new GravenCairns(this);
}
}
class GravenCairnsFirstManaAbility extends BasicManaAbility<GravenCairnsFirstManaAbility> {
public GravenCairnsFirstManaAbility() {
super(new BasicManaEffect(new Mana(0, 0, 0, 0, 2, 0, 0)));
this.addManaCost(new ManaCostsImpl("{B/R}"));
this.netMana.setBlack(2);
}
public GravenCairnsFirstManaAbility(final GravenCairnsFirstManaAbility ability) {
super(ability);
}
@Override
public GravenCairnsFirstManaAbility copy() {
return new GravenCairnsFirstManaAbility(this);
}
}
class GravenCairnsSecondManaAbility extends BasicManaAbility<GravenCairnsSecondManaAbility> {
public GravenCairnsSecondManaAbility() {
super(new BasicManaEffect(new Mana(1, 0, 0, 0, 1, 0, 0)));
this.addManaCost(new ManaCostsImpl("{B/R}"));
this.netMana.setBlack(1);
this.netMana.setRed(1);
}
public GravenCairnsSecondManaAbility(final GravenCairnsSecondManaAbility ability) {
super(ability);
}
@Override
public GravenCairnsSecondManaAbility copy() {
return new GravenCairnsSecondManaAbility(this);
}
}
class GravenCairnsThirdManaAbility extends BasicManaAbility<GravenCairnsThirdManaAbility> {
public GravenCairnsThirdManaAbility() {
super(new BasicManaEffect(new Mana(2, 0, 0, 0, 0, 0, 0)));
this.addManaCost(new ManaCostsImpl("{B/R}"));
this.netMana.setRed(2);
}
public GravenCairnsThirdManaAbility(final GravenCairnsThirdManaAbility ability) {
super(ability);
}
@Override
public GravenCairnsThirdManaAbility copy() {
return new GravenCairnsThirdManaAbility(this);
}
}

View file

@ -1,90 +0,0 @@
/*
* 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.effects.common;
import mage.Constants;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author jeff
*/
public class MillTargetEffect extends OneShotEffect<MillTargetEffect> {
int count = 0;
public MillTargetEffect(final MillTargetEffect effect) {
super(effect);
this.count = effect.count;
}
public MillTargetEffect(final int count) {
super(Constants.Outcome.Detriment);
this.count = count;
getText();
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null) {
for (int i = 0; i < count; i++) {
if (!targetPlayer.getLibrary().getCardList().isEmpty()) {
Card card = targetPlayer.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, false);
}
}
}
return true;
}
return false;
}
@Override
public MillTargetEffect copy() {
return new MillTargetEffect(this);
}
private void getText() {
StringBuilder sb = new StringBuilder("Target player puts the top ");
if (count > 1) {
sb.append(count).append(" cards of his or her library into his or her graveyard");
}else {
sb.append("card of his or her library into his or her graveyard");
}
staticText = sb.toString();
}
}