- Requested. Added Anvil of Bogardan and Drowner of Secrets.

This commit is contained in:
jeffwadsworth 2012-07-30 22:36:32 -05:00
parent 71a3cdb83f
commit 90ab9a759c
5 changed files with 332 additions and 78 deletions

View file

@ -28,7 +28,6 @@
package mage.sets.fifthedition;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.cards.CardImpl;
@ -37,11 +36,8 @@ 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;
import mage.abilities.effects.OneShotEffect;
import mage.players.Player;
import mage.cards.Card;
import mage.game.Game;
/**
*
@ -54,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 MillstoneEffect(2), new GenericManaCost(2));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MillTargetEffect(2), new GenericManaCost(2));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
@ -69,41 +65,3 @@ public class Millstone extends CardImpl<Millstone> {
return new Millstone(this);
}
}
class MillstoneEffect extends OneShotEffect<MillstoneEffect> {
int count = 0;
public MillstoneEffect(final MillstoneEffect effect) {
super(effect);
this.count = effect.count;
}
public MillstoneEffect(final int count) {
super(Constants.Outcome.Detriment);
this.count = count;
this.staticText = "Target player puts the top " + count + " cards of his or her library into his or her graveyard";
}
@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(Zone.GRAVEYARD, source.getId(), game, false);
}
}
}
return true;
}
return false;
}
@Override
public MillstoneEffect copy() {
return new MillstoneEffect(this);
}
}

View file

@ -0,0 +1,84 @@
/*
* 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.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
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.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.target.TargetPlayer;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author jeffwadsworth
*/
public class DrownerOfSecrets extends CardImpl<DrownerOfSecrets> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("untapped Merfolk you control");
static {
filter.add(new SubtypePredicate("Merfolk"));
filter.add(Predicates.not(new TappedPredicate()));
}
public DrownerOfSecrets(UUID ownerId) {
super(ownerId, 58, "Drowner of Secrets", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.expansionSetCode = "LRW";
this.subtype.add("Merfolk");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(1);
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.addTarget(new TargetPlayer());
this.addAbility(ability);
}
public DrownerOfSecrets(final DrownerOfSecrets card) {
super(card);
}
@Override
public DrownerOfSecrets copy() {
return new DrownerOfSecrets(this);
}
}

View file

@ -0,0 +1,98 @@
/*
* 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.visions;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfDrawTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.MaximumHandSizeControllerEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public class AnvilOfBogardan extends CardImpl<AnvilOfBogardan> {
public AnvilOfBogardan(UUID ownerId) {
super(ownerId, 141, "Anvil of Bogardan", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "VIS";
// Players have no maximum hand size.
Effect effect = new MaximumHandSizeControllerEffect(Integer.MAX_VALUE, Constants.Duration.WhileOnBattlefield, false, true);
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, effect));
// At the beginning of each player's draw step, that player draws an additional card, then discards a card.
this.addAbility(new BeginningOfDrawTriggeredAbility(Constants.Zone.BATTLEFIELD, new AnvilOfBogardanEffect(), Constants.TargetController.ANY, false));
}
public AnvilOfBogardan(final AnvilOfBogardan card) {
super(card);
}
@Override
public AnvilOfBogardan copy() {
return new AnvilOfBogardan(this);
}
}
class AnvilOfBogardanEffect extends OneShotEffect<AnvilOfBogardanEffect> {
public AnvilOfBogardanEffect(final AnvilOfBogardanEffect effect) {
super(effect);
}
public AnvilOfBogardanEffect() {
super(Constants.Outcome.Neutral);
staticText = "that player draws an additional card, then discards a card";
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
if (targetPlayer != null) {
targetPlayer.drawCards(1, game);
targetPlayer.discard(1, source, game);
return true;
}
return false;
}
@Override
public AnvilOfBogardanEffect copy() {
return new AnvilOfBogardanEffect(this);
}
}

View file

@ -0,0 +1,90 @@
/*
* 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();
}
}

View file

@ -1,31 +1,30 @@
/*
* 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.
*/
* 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.continious;
import mage.Constants.Duration;
@ -44,11 +43,13 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl<Maximu
protected int handSize;
protected boolean reduce;
protected boolean allPlayers;
/**
* @param handSize Maximum hand size to set or to reduce by
* @param duration Effect duration
* @param reduce If true, the hand size will be reduced related to current value, otherwise it will be set.
* @param reduce If true, the hand size will be reduced related to current
* value, otherwise it will be set.
*/
public MaximumHandSizeControllerEffect(int handSize, Duration duration, boolean reduce) {
super(duration, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
@ -57,10 +58,19 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl<Maximu
setText();
}
public MaximumHandSizeControllerEffect(int handSize, Duration duration, boolean reduce, boolean allPlayers) {
super(duration, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
this.handSize = handSize;
this.reduce = reduce;
this.allPlayers = allPlayers;
setText();
}
public MaximumHandSizeControllerEffect(final MaximumHandSizeControllerEffect effect) {
super(effect);
this.handSize = effect.handSize;
this.reduce = effect.reduce;
this.allPlayers = effect.allPlayers;
}
@Override
@ -71,7 +81,19 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl<Maximu
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
if (allPlayers) {
for (Player playerid : game.getPlayers().values()) {
if (playerid != null) {
if (reduce) {
player.setMaxHandSize(player.getMaxHandSize() - handSize);
} else {
player.setMaxHandSize(handSize);
}
}
}
return true;
}
if (!allPlayers && player != null) {
if (reduce) {
player.setMaxHandSize(player.getMaxHandSize() - handSize);
} else {
@ -83,10 +105,13 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl<Maximu
}
private void setText() {
if (handSize == Integer.MAX_VALUE) {
if (allPlayers && handSize == Integer.MAX_VALUE) {
staticText = "All players have no maximum hand size";
}
if (!allPlayers && handSize == Integer.MAX_VALUE) {
staticText = "You have no maximum hand size";
} else {
}
if (!allPlayers && staticText == null) {
StringBuilder sb = new StringBuilder("Your maximum hand size is ");
if (reduce) {
sb.append("reduced by ");
@ -97,5 +122,4 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl<Maximu
staticText = sb.toString();
}
}
}