- Added Disaster Radius, Repay in Kind, and Devastating Summons. <ROE>

This commit is contained in:
jeffwadsworth 2012-07-26 16:27:21 -05:00
parent 1eb230e236
commit 23e0eb71bc
3 changed files with 385 additions and 0 deletions

View file

@ -0,0 +1,172 @@
/*
* 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.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.VariableCost;
import mage.abilities.dynamicvalue.common.GetXValue;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.FilterMana;
import mage.filter.common.FilterLandPermanent;
import mage.game.Game;
import mage.game.permanent.token.Token;
import mage.target.common.TargetLandPermanent;
/**
*
* @author jeffwadsworth
*/
public class DevastatingSummons extends CardImpl<DevastatingSummons> {
public DevastatingSummons(UUID ownerId) {
super(ownerId, 140, "Devastating Summons", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{R}");
this.expansionSetCode = "ROE";
this.color.setRed(true);
// As an additional cost to cast Devastating Summons, sacrifice X lands.
this.getSpellAbility().addCost(new DevastatingSummonsCost());
// Put two X/X red Elemental creature tokens onto the battlefield.
this.getSpellAbility().addEffect(new DevastatingSummonsEffect());
}
public DevastatingSummons(final DevastatingSummons card) {
super(card);
}
@Override
public DevastatingSummons copy() {
return new DevastatingSummons(this);
}
}
class DevastatingSummonsCost extends CostImpl<DevastatingSummonsCost> implements VariableCost {
protected int amountPaid = 0;
public DevastatingSummonsCost() {
this.text = "sacrifice X lands.";
}
public DevastatingSummonsCost(final DevastatingSummonsCost cost) {
super(cost);
this.amountPaid = cost.amountPaid;
}
@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) {
amountPaid = 0;
FilterLandPermanent filter = new FilterLandPermanent("X number of lands you control.");
TargetLandPermanent target = new TargetLandPermanent(filter);
while (true) {
target.clearChosen();
if (target.canChoose(controllerId, game) && target.choose(Constants.Outcome.Sacrifice, controllerId, sourceId, game)) {
UUID land = target.getFirstTarget();
if (land != null) {
game.getPermanent(land).sacrifice(sourceId, game);
amountPaid++;
}
}
else
break;
}
paid = true;
return true;
}
@Override
public int getAmount() {
return amountPaid;
}
@Override
public void setFilter(FilterMana filter) {
}
@Override
public DevastatingSummonsCost copy() {
return new DevastatingSummonsCost(this);
}
@Override
public void setAmount(int amount) {
amountPaid = amount;
}
}
class DevastatingSummonsEffect extends OneShotEffect<DevastatingSummonsEffect> {
public DevastatingSummonsEffect() {
super(Constants.Outcome.PutCreatureInPlay);
staticText = "Put two X/X red Elemental creature tokens onto the battlefield";
}
public DevastatingSummonsEffect(final DevastatingSummonsEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
ElementalToken token = new ElementalToken();
token.getPower().setValue(new GetXValue().calculate(game, source));
token.getToughness().setValue(new GetXValue().calculate(game, source));
token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId());
return true;
}
@Override
public DevastatingSummonsEffect copy() {
return new DevastatingSummonsEffect(this);
}
}
class ElementalToken extends Token {
public ElementalToken() {
super("Elemental", "X/X red Elemental creature");
cardType.add(CardType.CREATURE);
color = ObjectColor.RED;
subtype.add("Elemental");
}
}

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.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.abilities.Ability;
import mage.abilities.costs.common.RevealTargetFromHandCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInHand;
/**
*
* @author jeffwadsworth
*/
public class DisasterRadius extends CardImpl<DisasterRadius> {
public DisasterRadius(UUID ownerId) {
super(ownerId, 141, "Disaster Radius", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{5}{R}{R}");
this.expansionSetCode = "ROE";
this.color.setRed(true);
// As an additional cost to cast Disaster Radius, reveal a creature card from your hand.
TargetCardInHand targetCard = new TargetCardInHand(new FilterCreatureCard("a creature card."));
this.getSpellAbility().addCost(new RevealTargetFromHandCost(targetCard));
// Disaster Radius deals X damage to each creature your opponents control, where X is the revealed card's converted mana cost.
this.getSpellAbility().addEffect(new DisasterRadiusEffect());
}
public DisasterRadius(final DisasterRadius card) {
super(card);
}
@Override
public DisasterRadius copy() {
return new DisasterRadius(this);
}
}
class DisasterRadiusEffect extends OneShotEffect<DisasterRadiusEffect> {
final private static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature your opponents control");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public DisasterRadiusEffect() {
super(Constants.Outcome.GainLife);
staticText = "{this} deals X damage to each creature your opponents control, where X is the revealed card's converted mana cost";
}
public DisasterRadiusEffect(DisasterRadiusEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0);
if (cost != null) {
int damage = cost.convertedManaCosts;
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
if (creature != null) {
creature.damage(damage, source.getId(), game, false, false);
}
}
return true;
}
return false;
}
@Override
public DisasterRadiusEffect copy() {
return new DisasterRadiusEffect(this);
}
}

View file

@ -0,0 +1,100 @@
/*
* 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.riseoftheeldrazi;
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.cards.CardImpl;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public class RepayInKind extends CardImpl<RepayInKind> {
public RepayInKind(UUID ownerId) {
super(ownerId, 125, "Repay in Kind", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{5}{B}{B}");
this.expansionSetCode = "ROE";
this.color.setBlack(true);
// Each player's life total becomes the lowest life total among all players.
this.getSpellAbility().addEffect(new RepayInKindEffect());
}
public RepayInKind(final RepayInKind card) {
super(card);
}
@Override
public RepayInKind copy() {
return new RepayInKind(this);
}
}
class RepayInKindEffect extends OneShotEffect<RepayInKindEffect> {
public RepayInKindEffect() {
super(Constants.Outcome.Tap);
staticText = "Each player's life total becomes the lowest life total among all players";
}
public RepayInKindEffect(final RepayInKindEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int lowestLife = game.getPlayer(source.getControllerId()).getLife();
for (Player playerid : game.getPlayers().values()) {
if (playerid != null) {
if (lowestLife > playerid.getLife()) {
lowestLife = playerid.getLife();
}
}
}
for (Player playerId : game.getPlayers().values()) {
if (playerId != null) {
playerId.setLife(lowestLife, game);
}
}
return true;
}
@Override
public RepayInKindEffect copy() {
return new RepayInKindEffect(this);
}
}