[GTC] Whispering Madness, Orzhov Charm, Mind Grind

This commit is contained in:
LevelX2 2013-01-31 23:40:14 +01:00
parent f38c5d2474
commit e11970be19
3 changed files with 412 additions and 0 deletions

View file

@ -0,0 +1,130 @@
/*
* 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.gatecrash;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.costs.VariableCost;
import mage.abilities.costs.mana.VariableManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class MindGrind extends CardImpl<MindGrind> {
public MindGrind(UUID ownerId) {
super(ownerId, 178, "Mind Grind", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{U}{B}");
this.expansionSetCode = "GTC";
this.color.setBlue(true);
this.color.setBlack(true);
// Each opponent reveals cards from the top of his or her library until he or she reveals X land cards, then puts all cards revealed this way into his or her graveyard. X can't be 0.
this.getSpellAbility().addEffect(new MindGrindEffect());
for (VariableCost cost: this.getSpellAbility().getManaCosts().getVariableCosts()) {
if (cost instanceof VariableManaCost) {
((VariableManaCost) cost).setMinX(1);
break;
}
}
}
public MindGrind(final MindGrind card) {
super(card);
}
@Override
public MindGrind copy() {
return new MindGrind(this);
}
}
class MindGrindEffect extends OneShotEffect<MindGrindEffect> {
public MindGrindEffect() {
super(Outcome.Discard);
this.staticText = "Each opponent reveals cards from the top of his or her library until he or she reveals X land cards, then puts all cards revealed this way into his or her graveyard. X can't be 0";
}
public MindGrindEffect(final MindGrindEffect effect) {
super(effect);
}
@Override
public MindGrindEffect copy() {
return new MindGrindEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int xValue = source.getManaCostsToPay().getX();
Card sourceCard = game.getCard(source.getSourceId());
if (xValue < 1 || sourceCard == null) {
return false;
}
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
Player player = game.getPlayer(opponentId);
if (player == null) {
continue;
}
int landsToReveal = xValue;
Cards cards = new CardsImpl();
while(player.getLibrary().size() > 0){
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
if(card.getCardType().contains(CardType.LAND)){
--landsToReveal;
if (landsToReveal < 1) {
break;
}
}
}
}
player.revealCards(new StringBuilder("by ").append(sourceCard.getName()).append(" from ").append(player.getName()).toString(), cards, game);
for(Card card : cards.getCards(game)){
if(card != null){
card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, false);
}
}
}
return true;
}
}

View file

@ -0,0 +1,166 @@
/*
* 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.gatecrash;
import java.util.LinkedList;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class OrzhovCharm extends CardImpl<OrzhovCharm> {
private static final FilterCard filter = new FilterCreatureCard("creature card with converted mana cost 1 or less from your graveyard");
static {
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 2));
}
public OrzhovCharm(UUID ownerId) {
super(ownerId, 185, "Orzhov Charm", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{W}{B}");
this.expansionSetCode = "GTC";
this.color.setBlack(true);
this.color.setWhite(true);
//Choose one - Return target creature you control and all Auras you control attached to it to their owner's hand
this.getSpellAbility().addEffect(new OrzhovCharmReturnToHandEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
// or destroy target creature and you lose life equal to its toughness;
Mode mode = new Mode();
mode.getEffects().add(new OrzhovCharmDestroyAndLoseLifeEffect());
mode.getTargets().add(new TargetCreaturePermanent());
this.getSpellAbility().addMode(mode);
// or return target creature card with converted mana cost 1 or less from your graveyard to the battlefield.
Mode mode2 = new Mode();
mode2.getEffects().add(new ReturnFromGraveyardToBattlefieldTargetEffect());
mode2.getTargets().add(new TargetCardInYourGraveyard(filter));
this.getSpellAbility().addMode(mode2);
}
public OrzhovCharm(final OrzhovCharm card) {
super(card);
}
@Override
public OrzhovCharm copy() {
return new OrzhovCharm(this);
}
}
class OrzhovCharmReturnToHandEffect extends OneShotEffect<OrzhovCharmReturnToHandEffect> {
public OrzhovCharmReturnToHandEffect() {
super(Outcome.ReturnToHand);
this.staticText = "Return target creature you control and all Auras you control attached to it to their owner's hand";
}
public OrzhovCharmReturnToHandEffect(final OrzhovCharmReturnToHandEffect effect) {
super(effect);
}
@Override
public OrzhovCharmReturnToHandEffect copy() {
return new OrzhovCharmReturnToHandEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
if (target != null) {
LinkedList<UUID> attachments = new LinkedList<UUID>();
attachments.addAll(target.getAttachments());
for (UUID attachmentId : attachments) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getControllerId().equals(source.getControllerId())) {
attachment.moveToZone(Zone.HAND, source.getSourceId(), game, false);
}
}
if (target.getControllerId().equals(source.getControllerId())) {
target.moveToZone(Zone.HAND, source.getSourceId(), game, false);
}
return true;
}
return false;
}
}
class OrzhovCharmDestroyAndLoseLifeEffect extends OneShotEffect<OrzhovCharmDestroyAndLoseLifeEffect> {
public OrzhovCharmDestroyAndLoseLifeEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "destroy target creature and you lose life equal to its toughness";
}
public OrzhovCharmDestroyAndLoseLifeEffect(final OrzhovCharmDestroyAndLoseLifeEffect effect) {
super(effect);
}
@Override
public OrzhovCharmDestroyAndLoseLifeEffect copy() {
return new OrzhovCharmDestroyAndLoseLifeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (target != null && controller != null) {
int toughness = target.getToughness().getValue();
target.destroy(source.getSourceId(), game, false);
if (toughness > 0) {
controller.loseLife(toughness, game);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,116 @@
/*
* 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.gatecrash;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CipherEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class WhisperingMadness extends CardImpl<WhisperingMadness> {
public WhisperingMadness(UUID ownerId) {
super(ownerId, 207, "Whispering Madness", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{U}{B}");
this.expansionSetCode = "GTC";
this.color.setBlue(true);
this.color.setBlack(true);
// Each player discards his or her hand, then draws cards equal to the greatest number of cards a player discarded this way.
this.getSpellAbility().addEffect(new WhisperingMadnessEffect());
// Cipher
this.getSpellAbility().addEffect(new CipherEffect());
}
public WhisperingMadness(final WhisperingMadness card) {
super(card);
}
@Override
public WhisperingMadness copy() {
return new WhisperingMadness(this);
}
}
class WhisperingMadnessEffect extends OneShotEffect<WhisperingMadnessEffect> {
WhisperingMadnessEffect() {
super(Constants.Outcome.Discard);
staticText = "Each player discards his or her hand, then draws cards equal to the greatest number of cards a player discarded this way";
}
WhisperingMadnessEffect(final WhisperingMadnessEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int maxDiscarded = 0;
Player sourcePlayer = game.getPlayer(source.getControllerId());
if (sourcePlayer == null) {
return false;
}
for (UUID playerId : sourcePlayer.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
int discarded = 0;
for (Card c : player.getHand().getCards(game)) {
if (player.discard(c, source, game)) {
discarded++;
}
}
if (discarded > maxDiscarded) {
maxDiscarded = discarded;
}
}
}
for (UUID playerId : sourcePlayer.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.drawCards(maxDiscarded, game);
}
}
return true;
}
@Override
public WhisperingMadnessEffect copy() {
return new WhisperingMadnessEffect(this);
}
}