- Added Quest For Pure Flame, Relic Crush, Baloth Cage Trap, Eternity Vessel, Runeflare Trap, Tanglesap, Inferno Trap.

This commit is contained in:
jeffwadsworth 2012-12-20 16:40:09 -06:00
parent fde10788db
commit 709d3cc4b1
7 changed files with 952 additions and 0 deletions

View file

@ -0,0 +1,155 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.watchers.WatcherImpl;
/**
*
* @author jeffwadsworth
*/
public class BalothCageTrap extends CardImpl<BalothCageTrap> {
public BalothCageTrap(UUID ownerId) {
super(ownerId, 156, "Baloth Cage Trap", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{3}{G}{G}");
this.expansionSetCode = "ZEN";
this.subtype.add("Trap");
this.color.setGreen(true);
// If an opponent had an artifact enter the battlefield under his or her control this turn, you may pay {1}{G} rather than pay Baloth Cage Trap's mana cost.
this.getSpellAbility().addAlternativeCost(new BalothCageTrapAlternativeCost());
this.addWatcher(new BalothCageTrapWatcher());
// Put a 4/4 green Beast creature token onto the battlefield.
this.getSpellAbility().addEffect(new CreateTokenEffect(new BeastGreenToken()));
}
public BalothCageTrap(final BalothCageTrap card) {
super(card);
}
@Override
public BalothCageTrap copy() {
return new BalothCageTrap(this);
}
}
class BalothCageTrapWatcher extends WatcherImpl<BalothCageTrapWatcher> {
public BalothCageTrapWatcher() {
super("BalothCageTrapWatcher", Constants.WatcherScope.GAME);
}
public BalothCageTrapWatcher(final BalothCageTrapWatcher watcher) {
super(watcher);
}
@Override
public BalothCageTrapWatcher copy() {
return new BalothCageTrapWatcher(this);
}
@Override
public void watch(GameEvent event, Game game) {
if (condition == true) { // no need to check - condition has already occured
return;
}
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent perm = game.getPermanent(event.getTargetId());
if (perm.getCardType().contains(CardType.ARTIFACT) && !perm.getControllerId().equals(controllerId)) {
condition = true;
}
}
}
@Override
public void reset() {
super.reset();
condition = false;
}
}
class BalothCageTrapAlternativeCost extends AlternativeCostImpl<BalothCageTrapAlternativeCost> {
public BalothCageTrapAlternativeCost() {
super("you may pay {1}{G} rather than pay Baloth Cage Trap's mana cost");
this.add(new ManaCostsImpl("{1}{G}"));
}
public BalothCageTrapAlternativeCost(final BalothCageTrapAlternativeCost cost) {
super(cost);
}
@Override
public BalothCageTrapAlternativeCost copy() {
return new BalothCageTrapAlternativeCost(this);
}
@Override
public boolean isAvailable(Game game, Ability source) {
BalothCageTrapWatcher watcher = (BalothCageTrapWatcher) game.getState().getWatchers().get("BalothCageTrapWatcher");
if (watcher != null && watcher.conditionMet()) {
return true;
}
return false;
}
@Override
public String getText() {
return "If an opponent had an artifact enter the battlefield under his or her control this turn, you may pay {1}{G} rather than pay Baloth Cage Trap's mana cost";
}
}
class BeastGreenToken extends Token {
public BeastGreenToken() {
super("Beast", "4/4 green Beast creature token");
cardType.add(CardType.CREATURE);
color = ObjectColor.GREEN;
subtype.add("Beast");
power = new MageInt(4);
toughness = new MageInt(4);
}
}

View file

@ -0,0 +1,132 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.LandfallAbility;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public class EternityVessel extends CardImpl<EternityVessel> {
public EternityVessel(UUID ownerId) {
super(ownerId, 200, "Eternity Vessel", Rarity.MYTHIC, new CardType[]{CardType.ARTIFACT}, "{6}");
this.expansionSetCode = "ZEN";
// Eternity Vessel enters the battlefield with X charge counters on it, where X is your life total.
this.addAbility(new EntersBattlefieldAbility(new EternityVesselEffect()));
// Landfall - Whenever a land enters the battlefield under your control, you may have your life total become the number of charge counters on Eternity Vessel.
this.addAbility(new LandfallAbility(Constants.Zone.BATTLEFIELD, new EternityVesselEffect2(), true));
}
public EternityVessel(final EternityVessel card) {
super(card);
}
@Override
public EternityVessel copy() {
return new EternityVessel(this);
}
}
class EternityVesselEffect extends OneShotEffect<EternityVesselEffect> {
public EternityVesselEffect() {
super(Outcome.Benefit);
staticText = "with X charge counters on it, where X is your life total";
}
public EternityVesselEffect(final EternityVesselEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent vessel = game.getPermanent(source.getSourceId());
Player you = game.getPlayer(source.getControllerId());
if (vessel != null && you != null) {
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
if (obj != null && obj instanceof SpellAbility) {
int amount = you.getLife();
if (amount > 0) {
vessel.addCounters(CounterType.CHARGE.createInstance(amount), game);
return true;
}
}
}
return true;
}
@Override
public EternityVesselEffect copy() {
return new EternityVesselEffect(this);
}
}
class EternityVesselEffect2 extends OneShotEffect<EternityVesselEffect2> {
public EternityVesselEffect2() {
super(Outcome.Benefit);
staticText = "you may have your life total become the number of charge counters on Eternity Vessel";
}
public EternityVesselEffect2(final EternityVesselEffect2 effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent vessel = game.getPermanent(source.getSourceId());
Player you = game.getPlayer(source.getControllerId());
if (vessel != null && you != null) {
you.setLife(vessel.getCounters().getCount(CounterType.CHARGE), game);
return true;
}
return false;
}
@Override
public EternityVesselEffect2 copy() {
return new EternityVesselEffect2(this);
}
}

View file

@ -0,0 +1,144 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.WatcherImpl;
/**
*
* @author jeffwadsworth
*/
public class InfernoTrap extends CardImpl<InfernoTrap> {
public InfernoTrap(UUID ownerId) {
super(ownerId, 133, "Inferno Trap", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{3}{R}");
this.expansionSetCode = "ZEN";
this.subtype.add("Trap");
this.color.setRed(true);
// If you've been dealt damage by two or more creatures this turn, you may pay {R} rather than pay Inferno Trap's mana cost.
this.getSpellAbility().addAlternativeCost(new InfernoTrapAlternativeCost());
this.addWatcher(new ControllerDamagedByCreatureWatcher());
// Inferno Trap deals 4 damage to target creature.
this.getSpellAbility().addEffect(new DamageTargetEffect(4));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public InfernoTrap(final InfernoTrap card) {
super(card);
}
@Override
public InfernoTrap copy() {
return new InfernoTrap(this);
}
}
class ControllerDamagedByCreatureWatcher extends WatcherImpl<ControllerDamagedByCreatureWatcher> {
int numCreaturesDamagedController;
public ControllerDamagedByCreatureWatcher() {
super("ControllerDamagedByCreatureWatcher", Constants.WatcherScope.GAME);
}
public ControllerDamagedByCreatureWatcher(final ControllerDamagedByCreatureWatcher watcher) {
super(watcher);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER
&& event.getTargetId().equals(controllerId)) {
Card card = game.getCard(event.getSourceId());
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
numCreaturesDamagedController += 1;
if (numCreaturesDamagedController >= 2) {
condition = true;
}
}
}
}
@Override
public void reset() {
super.reset();
numCreaturesDamagedController = 0;
}
@Override
public ControllerDamagedByCreatureWatcher copy() {
return new ControllerDamagedByCreatureWatcher(this);
}
}
class InfernoTrapAlternativeCost extends AlternativeCostImpl<InfernoTrapAlternativeCost> {
public InfernoTrapAlternativeCost() {
super("you may pay {R} rather than pay Inferno Trap's mana cost");
this.add(new ManaCostsImpl("{R}"));
}
public InfernoTrapAlternativeCost(final InfernoTrapAlternativeCost cost) {
super(cost);
}
@Override
public InfernoTrapAlternativeCost copy() {
return new InfernoTrapAlternativeCost(this);
}
@Override
public boolean isAvailable(Game game, Ability source) {
ControllerDamagedByCreatureWatcher watcher = (ControllerDamagedByCreatureWatcher) game.getState().getWatchers().get("ControllerDamagedByCreatureWatcher");
if (watcher != null && watcher.conditionMet()) {
return true;
}
return false;
}
@Override
public String getText() {
return "If you've been dealt damage by two or more creatures this turn, you may pay {R} rather than pay Inferno Trap's mana cost";
}
}

View file

@ -0,0 +1,169 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public class QuestForPureFlame extends CardImpl<QuestForPureFlame> {
public QuestForPureFlame(UUID ownerId) {
super(ownerId, 144, "Quest for Pure Flame", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{R}");
this.expansionSetCode = "ZEN";
this.color.setRed(true);
// Whenever a source you control deals damage to an opponent, you may put a quest counter on Quest for Pure Flame.
this.addAbility(new QuestForPureFlameTriggeredAbility());
// Remove four quest counters from Quest for Pure Flame and sacrifice it: If any source you control would deal damage to a creature or player this turn, it deals double that damage to that creature or player instead.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new QuestForPureFlameEffect(), new RemoveCountersSourceCost(CounterType.QUEST.createInstance(4)));
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}
public QuestForPureFlame(final QuestForPureFlame card) {
super(card);
}
@Override
public QuestForPureFlame copy() {
return new QuestForPureFlame(this);
}
}
class QuestForPureFlameTriggeredAbility extends TriggeredAbilityImpl<QuestForPureFlameTriggeredAbility> {
public QuestForPureFlameTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true);
}
public QuestForPureFlameTriggeredAbility(final QuestForPureFlameTriggeredAbility ability) {
super(ability);
}
@Override
public QuestForPureFlameTriggeredAbility copy() {
return new QuestForPureFlameTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER)
&& game.getOpponents(controllerId).contains(event.getTargetId())) {
Permanent permanent = game.getPermanent(event.getSourceId());
Player player = game.getPlayer(event.getSourceId());
StackObject spell = game.getStack().getStackObject(event.getSourceId());
if (permanent != null && permanent.getControllerId().equals(controllerId)) {
return true;
}
if (player != null && player.getId().equals(controllerId)) {
return true;
}
if (spell != null && spell.getControllerId().equals(controllerId)) {
return true;
}
return false;
}
return false;
}
@Override
public String getRule() {
return "Whenever a source you control deals damage to an opponent, you may put a quest counter on Quest for Pure Flame.";
}
}
class QuestForPureFlameEffect extends ReplacementEffectImpl<QuestForPureFlameEffect> {
public QuestForPureFlameEffect() {
super(Constants.Duration.EndOfTurn, Constants.Outcome.Damage);
staticText = "If any source you control would deal damage to a creature or player this turn, it deals double that damage to that creature or player instead";
}
public QuestForPureFlameEffect(final QuestForPureFlameEffect effect) {
super(effect);
}
@Override
public QuestForPureFlameEffect copy() {
return new QuestForPureFlameEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)
|| event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)) {
Permanent permanent = game.getPermanent(event.getSourceId());
Player player = game.getPlayer(event.getSourceId());
StackObject spell = game.getStack().getStackObject(event.getSourceId());
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
event.setAmount(event.getAmount() * 2);
}
if (player != null && player.getId().equals(source.getControllerId())) {
event.setAmount(event.getAmount() * 2);
}
if (spell != null && spell.getControllerId().equals(source.getControllerId())) {
event.setAmount(event.getAmount() * 2);
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return apply(game, source);
}
}

View file

@ -0,0 +1,109 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
/**
*
* @author jeffwadsworth
*/
public class RelicCrush extends CardImpl<RelicCrush> {
private final static FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
(new CardTypePredicate(CardType.ARTIFACT)),
(new CardTypePredicate(CardType.ENCHANTMENT))));
}
public RelicCrush(UUID ownerId) {
super(ownerId, 179, "Relic Crush", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{4}{G}");
this.expansionSetCode = "ZEN";
this.color.setGreen(true);
// Destroy target artifact or enchantment and up to one other target artifact or enchantment.
this.getSpellAbility().addEffect(new RelicCrushEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter, false));
}
public RelicCrush(final RelicCrush card) {
super(card);
}
@Override
public RelicCrush copy() {
return new RelicCrush(this);
}
}
class RelicCrushEffect extends OneShotEffect<RelicCrushEffect> {
public RelicCrushEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Destroy target artifact or enchantment and up to one other target artifact or enchantment";
}
public RelicCrushEffect(final RelicCrushEffect effect) {
super(effect);
}
@Override
public RelicCrushEffect copy() {
return new RelicCrushEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent firstTarget = game.getPermanent(source.getFirstTarget());
Permanent secondTarget = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (firstTarget != null) {
firstTarget.destroy(id, game, false);
}
if (secondTarget != null) {
return secondTarget.destroy(id, game, false);
}
return true;
}
}

View file

@ -0,0 +1,171 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.WatcherScope;
import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.watchers.WatcherImpl;
/**
*
* @author jeffwadsworth
*/
public class RuneflareTrap extends CardImpl<RuneflareTrap> {
public RuneflareTrap(UUID ownerId) {
super(ownerId, 146, "Runeflare Trap", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{R}{R}");
this.expansionSetCode = "ZEN";
this.subtype.add("Trap");
this.color.setRed(true);
// If an opponent drew three or more cards this turn, you may pay {R} rather than pay Runeflare Trap's mana cost.
this.getSpellAbility().addAlternativeCost(new RuneflareTrapAlternativeCost());
this.addWatcher(new CardsDrawnOpponentWatcher());
// Runeflare Trap deals damage to target player equal to the number of cards in that player's hand.
this.getSpellAbility().addEffect(new DamageTargetEffect(new TargetPlayerCardsInHandCount()));
this.getSpellAbility().addTarget(new TargetPlayer());
}
public RuneflareTrap(final RuneflareTrap card) {
super(card);
}
@Override
public RuneflareTrap copy() {
return new RuneflareTrap(this);
}
}
class TargetPlayerCardsInHandCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility) {
Player targetPlayer = game.getPlayer(sourceAbility.getFirstTarget());
if (targetPlayer != null) {
return targetPlayer.getHand().size();
}
return 0;
}
@Override
public DynamicValue clone() {
return new TargetPlayerCardsInHandCount();
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "target player's cards in hand";
}
}
class CardsDrawnOpponentWatcher extends WatcherImpl<CardsDrawnOpponentWatcher> {
int cardsDrawn;
public CardsDrawnOpponentWatcher() {
super("CardsDrawnOpponentWatcher", WatcherScope.GAME);
}
public CardsDrawnOpponentWatcher(final CardsDrawnOpponentWatcher watcher) {
super(watcher);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DREW_CARD
&& game.getOpponents(controllerId).contains(event.getPlayerId())) {
cardsDrawn += 1;
if (cardsDrawn >= 3) {
condition = true;
}
}
}
@Override
public void reset() {
super.reset();
cardsDrawn = 0;
}
@Override
public CardsDrawnOpponentWatcher copy() {
return new CardsDrawnOpponentWatcher(this);
}
}
class RuneflareTrapAlternativeCost extends AlternativeCostImpl<RuneflareTrapAlternativeCost> {
public RuneflareTrapAlternativeCost() {
super("you may pay {R} rather than pay Runeflare Trap's mana cost");
this.add(new ManaCostsImpl("{R}"));
}
public RuneflareTrapAlternativeCost(final RuneflareTrapAlternativeCost cost) {
super(cost);
}
@Override
public RuneflareTrapAlternativeCost copy() {
return new RuneflareTrapAlternativeCost(this);
}
@Override
public boolean isAvailable(Game game, Ability source) {
CardsDrawnOpponentWatcher watcher = (CardsDrawnOpponentWatcher) game.getState().getWatchers().get("CardsDrawnOpponentWatcher");
if (watcher != null && watcher.conditionMet()) {
return true;
}
return false;
}
@Override
public String getText() {
return "If an opponent drew three or more cards this turn, you may pay {R} rather than pay Runeflare Trap's mana cost";
}
}

View file

@ -0,0 +1,72 @@
/*
* 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.zendikar;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.effects.common.PreventAllDamageEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
* @author jeffwadsworth
*/
public class Tanglesap extends CardImpl<Tanglesap> {
final static private FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures without trample");
static {
filter.add(Predicates.not(new AbilityPredicate(TrampleAbility.class)));
}
public Tanglesap(UUID ownerId) {
super(ownerId, 186, "Tanglesap", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{G}");
this.expansionSetCode = "ZEN";
this.color.setGreen(true);
// Prevent all combat damage that would be dealt this turn by creatures without trample.
this.getSpellAbility().addEffect(new PreventAllDamageEffect(filter, Duration.EndOfTurn, true));
}
public Tanglesap(final Tanglesap card) {
super(card);
}
@Override
public Tanglesap copy() {
return new Tanglesap(this);
}
}