- Added Put Away, Thought Reflection, Cinderhaze Wretch, and Whimwader.

This commit is contained in:
Jeff 2013-12-23 16:13:19 -06:00
parent 05cbd90fe2
commit 7488679872
4 changed files with 472 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.shadowmoor;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.DiscardTargetEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
import mage.util.CardUtil;
/**
*
* @author jeffwadsworth
*
*/
public class CinderhazeWretch extends CardImpl<CinderhazeWretch> {
public CinderhazeWretch(UUID ownerId) {
super(ownerId, 60, "Cinderhaze Wretch", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{B}");
this.expansionSetCode = "SHM";
this.subtype.add("Elemental");
this.subtype.add("Shaman");
this.color.setBlack(true);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// {tap}: Target player discards a card. Activate this ability only during your turn.
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new TapSourceCost(), MyTurnCondition.getInstance());
ability.addTarget(new TargetPlayer(true));
this.addAbility(ability);
// Put a -1/-1 counter on Cinderhaze Wretch: Untap Cinderhaze Wretch.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapSourceEffect(), new PutCounterSourceCost(CounterType.M1M1.createInstance(1))));
}
public CinderhazeWretch(final CinderhazeWretch card) {
super(card);
}
@Override
public CinderhazeWretch copy() {
return new CinderhazeWretch(this);
}
}
class PutCounterSourceCost extends CostImpl<PutCounterSourceCost> {
private int amount;
private String name;
private Counter counter;
public PutCounterSourceCost(Counter counter) {
this.counter = counter.copy();
this.amount = counter.getCount();
this.name = counter.getName();
this.text = new StringBuilder("Put ").append((amount == 1 ? "a" : CardUtil.numberToText(amount)))
.append(" ").append(name).append(" counter").append((amount != 1 ? "s" : ""))
.append(" on {this}").toString();
}
public PutCounterSourceCost(PutCounterSourceCost cost) {
super(cost);
this.counter = cost.counter;
this.amount = cost.amount;
this.name = cost.name;
}
@Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
return true;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null) {
permanent.addCounters(counter, game);
this.paid = true;
}
return paid;
}
@Override
public PutCounterSourceCost copy() {
return new PutCounterSourceCost(this);
}
}

View file

@ -0,0 +1,113 @@
/*
* 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.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetSpell;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author jeffwadsworth
*
*/
public class PutAway extends CardImpl<PutAway> {
public PutAway(UUID ownerId) {
super(ownerId, 48, "Put Away", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{U}{U}");
this.expansionSetCode = "SHM";
this.color.setBlue(true);
// Counter target spell. You may shuffle up to one target card from your graveyard into your library.
this.getSpellAbility().addEffect(new PutAwayEffect());
this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, 1, new FilterCard()));
}
public PutAway(final PutAway card) {
super(card);
}
@Override
public PutAway copy() {
return new PutAway(this);
}
}
class PutAwayEffect extends OneShotEffect<PutAwayEffect> {
boolean countered = false;
public PutAwayEffect() {
super(Outcome.Neutral);
this.staticText = "Counter target spell. You may shuffle up to one target card from your graveyard into your library";
}
public PutAwayEffect(final PutAwayEffect effect) {
super(effect);
}
@Override
public PutAwayEffect copy() {
return new PutAwayEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(source.getFirstTarget());
Card card = game.getCard(source.getTargets().get(1).getFirstTarget());
Player you = game.getPlayer(source.getControllerId());
if (spell != null
&& game.getStack().counter(spell.getId(), source.getSourceId(), game)) {
countered = true;
}
if (you != null) {
if (card != null
&& you.chooseUse(Outcome.Benefit, "Do you wish to shuffle up to one target card from your graveyard into your library?", game)
&& game.getState().getZone(card.getId()).match(Zone.GRAVEYARD)) {
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
you.shuffleLibrary(game);
}
}
return countered;
}
}

View file

@ -0,0 +1,110 @@
/*
* 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.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*
*/
public class ThoughtReflection extends CardImpl<ThoughtReflection> {
public ThoughtReflection(UUID ownerId) {
super(ownerId, 53, "Thought Reflection", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}{U}{U}");
this.expansionSetCode = "SHM";
this.color.setBlue(true);
// If you would draw a card, draw two cards instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ThoughtReflectionReplacementEffect()));
}
public ThoughtReflection(final ThoughtReflection card) {
super(card);
}
@Override
public ThoughtReflection copy() {
return new ThoughtReflection(this);
}
}
class ThoughtReflectionReplacementEffect extends ReplacementEffectImpl<ThoughtReflectionReplacementEffect> {
public ThoughtReflectionReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "If you would draw a card, draw two cards instead";
}
public ThoughtReflectionReplacementEffect(final ThoughtReflectionReplacementEffect effect) {
super(effect);
}
@Override
public ThoughtReflectionReplacementEffect copy() {
return new ThoughtReflectionReplacementEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player you = game.getPlayer(event.getPlayerId());
if (you != null) {
you.drawCards(2, game);
}
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DRAW_CARD
&& event.getPlayerId().equals(source.getControllerId())) {
return true;
}
return false;
}
}

View file

@ -0,0 +1,119 @@
/*
* 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.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author jeffwadsworth
*/
public class Whimwader extends CardImpl<Whimwader> {
public Whimwader(UUID ownerId) {
super(ownerId, 54, "Whimwader", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{U}");
this.expansionSetCode = "SHM";
this.subtype.add("Elemental");
this.color.setBlue(true);
this.power = new MageInt(6);
this.toughness = new MageInt(4);
// Whimwader can't attack unless defending player controls a blue permanent.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WhimwaderCantAttackEffect()));
}
public Whimwader(final Whimwader card) {
super(card);
}
@Override
public Whimwader copy() {
return new Whimwader(this);
}
}
class WhimwaderCantAttackEffect extends ReplacementEffectImpl<WhimwaderCantAttackEffect> {
private static final FilterPermanent filter = new FilterPermanent();;
static {
filter.add(new ColorPredicate(ObjectColor.BLUE));
}
public WhimwaderCantAttackEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "{this} can't attack unless defending player controls a blue permanent";
}
public WhimwaderCantAttackEffect(final WhimwaderCantAttackEffect effect) {
super(effect);
}
@Override
public WhimwaderCantAttackEffect copy() {
return new WhimwaderCantAttackEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER
&& source.getSourceId().equals(event.getSourceId())) {
if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
return true;
}
}
return false;
}
}