Added March of the Machines, Greater Gargadon and Restore Balance

This commit is contained in:
Plopman 2013-04-06 18:25:11 +02:00
parent ba4455e5cb
commit a63ca5cc6d
4 changed files with 488 additions and 0 deletions

View file

@ -0,0 +1,52 @@
/*
* 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.mirrodin;
import java.util.UUID;
/**
*
* @author Plopman
*/
public class MarchOfTheMachines extends mage.sets.tenth.MarchOfTheMachines {
public MarchOfTheMachines(UUID ownerId) {
super(ownerId);
this.cardNumber = 42;
this.expansionSetCode = "MRD";
}
public MarchOfTheMachines(final MarchOfTheMachines card) {
super(card);
}
@Override
public MarchOfTheMachines copy() {
return new MarchOfTheMachines(this);
}
}

View file

@ -0,0 +1,131 @@
/*
* 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.tenth;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.CardImpl;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author Plopman
*/
public class MarchOfTheMachines extends CardImpl<MarchOfTheMachines> {
public MarchOfTheMachines(UUID ownerId) {
super(ownerId, 91, "March of the Machines", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
this.expansionSetCode = "10E";
this.color.setBlue(true);
// Each noncreature artifact is an artifact creature with power and toughness each equal to its converted mana cost.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new MarchOfTheMachinesEffect()));
}
public MarchOfTheMachines(final MarchOfTheMachines card) {
super(card);
}
@Override
public MarchOfTheMachines copy() {
return new MarchOfTheMachines(this);
}
}
class MarchOfTheMachinesEffect extends ContinuousEffectImpl<MarchOfTheMachinesEffect> {
private static final FilterArtifactPermanent filter = new FilterArtifactPermanent();
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
public MarchOfTheMachinesEffect() {
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.BecomeCreature);
staticText = "Each noncreature artifact is an artifact creature with power and toughness each equal to its converted mana cost";
}
public MarchOfTheMachinesEffect(final MarchOfTheMachinesEffect effect) {
super(effect);
}
@Override
public MarchOfTheMachinesEffect copy() {
return new MarchOfTheMachinesEffect(this);
}
@Override
public boolean apply(Constants.Layer layer, Constants.SubLayer sublayer, Ability source, Game game) {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == Constants.SubLayer.NA) {
objects.clear();
for(Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)){
if(permanent != null){
objects.add(permanent.getId());
permanent.getCardType().add(CardType.CREATURE);
}
}
}
break;
case PTChangingEffects_7:
if (sublayer == Constants.SubLayer.SetPT_7b) {
for(UUID uuid : objects){
Permanent permanent = game.getPermanent(uuid);
if(permanent != null){
int manaCost = permanent.getManaCost().convertedManaCost();
permanent.getPower().setValue(manaCost);
permanent.getToughness().setValue(manaCost);
}
}
}
}
return true;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean hasLayer(Constants.Layer layer) {
return layer == Constants.Layer.PTChangingEffects_7 || layer == Constants.Layer.AbilityAddingRemovingEffects_6 || layer == Constants.Layer.ColorChangingEffects_5 || layer == Constants.Layer.TypeChangingEffects_4;
}
}

View file

@ -0,0 +1,120 @@
/*
* 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.timespiral;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author Plopman
*/
public class GreaterGargadon extends CardImpl<GreaterGargadon> {
public GreaterGargadon(UUID ownerId) {
super(ownerId, 161, "Greater Gargadon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{9}{R}");
this.expansionSetCode = "TSP";
this.subtype.add("Beast");
this.color.setRed(true);
this.power = new MageInt(9);
this.toughness = new MageInt(7);
// Suspend 10-{R}
this.addAbility(new SuspendAbility(10, new ManaCostsImpl("{R}"), this));
// Sacrifice an artifact, creature, or land: Remove a time counter from Greater Gargadon. Activate this ability only if Greater Gargadon is suspended.
this.addAbility(new GreaterGargadonAbility());
}
public GreaterGargadon(final GreaterGargadon card) {
super(card);
}
@Override
public GreaterGargadon copy() {
return new GreaterGargadon(this);
}
}
class GreaterGargadonAbility extends ActivatedAbilityImpl<GreaterGargadonAbility> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("artifact, creature, or land");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.LAND)));
}
public GreaterGargadonAbility() {
super(Constants.Zone.EXILED, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), new SacrificeTargetCost(new TargetControlledPermanent(filter)));
}
public GreaterGargadonAbility(final GreaterGargadonAbility ability) {
super(ability);
}
@Override
public GreaterGargadonAbility copy() {
return new GreaterGargadonAbility(this);
}
@Override
public boolean canActivate(UUID playerId, Game game) {
Card card = game.getCard(this.getSourceId());
if(super.canActivate(playerId, game) && card != null && card.getCounters().getCount(CounterType.TIME) > 0){
return true;
}
return false;
}
@Override
public String getRule() {
return super.getRule() + " Activate this ability only if Greater Gargadon is suspended";
}
}

View file

@ -0,0 +1,185 @@
/*
* 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.timespiral;
import java.util.ArrayList;
import java.util.List;
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.Mode;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author Plopman
*/
public class RestoreBalance extends CardImpl<RestoreBalance> {
public RestoreBalance(UUID ownerId) {
super(ownerId, 38, "Restore Balance", Rarity.RARE, new CardType[]{CardType.SORCERY}, "");
this.expansionSetCode = "TSP";
// Suspend 6-{W}
this.addAbility(new SuspendAbility(6, new ManaCostsImpl("{W}"), this));
// Each player chooses a number of lands he or she controls equal to the number of lands controlled by the player who controls the fewest, then sacrifices the rest. Players sacrifice creatures and discard cards the same way.
this.getSpellAbility().addEffect(new RestoreBalanceEffect());
}
public RestoreBalance(final RestoreBalance card) {
super(card);
}
@Override
public RestoreBalance copy() {
return new RestoreBalance(this);
}
}
class RestoreBalanceEffect extends OneShotEffect<RestoreBalanceEffect> {
public RestoreBalanceEffect() {
super(Constants.Outcome.Sacrifice);
}
public RestoreBalanceEffect(final RestoreBalanceEffect effect) {
super(effect);
}
@Override
public RestoreBalanceEffect copy() {
return new RestoreBalanceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int minLand = Integer.MAX_VALUE, minCreature = Integer.MAX_VALUE, minCard = Integer.MAX_VALUE;
//LAND
for(Player player : game.getPlayers().values()){
if(player != null){
int count = game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), player.getId(), source.getId(), game).size();
if(count < minLand){
minLand = count;
}
}
}
for(Player player : game.getPlayers().values()){
if(player != null){
TargetControlledPermanent target = new TargetControlledPermanent(minLand, minLand, new FilterControlledLandPermanent(), true);
target.setRequired(true);
if(target.choose(Outcome.Benefit, player.getId(), source.getId(), game)){
for(Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), player.getId(), source.getId(), game)){
if(permanent != null && !target.getTargets().contains(permanent.getId())){
permanent.sacrifice(source.getSourceId(), game);
}
}
}
}
}
//CREATURE
for(Player player : game.getPlayers().values()){
if(player != null){
int count = game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), player.getId(), source.getId(), game).size();
if(count < minCreature){
minCreature = count;
}
}
}
for(Player player : game.getPlayers().values()){
if(player != null){
TargetControlledPermanent target = new TargetControlledPermanent(minCreature, minCreature, new FilterControlledCreaturePermanent(), true);
target.setRequired(true);
if(target.choose(Outcome.Benefit, player.getId(), source.getId(), game)){
for(Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), player.getId(), source.getId(), game)){
if(permanent != null && !target.getTargets().contains(permanent.getId())){
permanent.sacrifice(source.getSourceId(), game);
}
}
}
}
}
//CARD IN HAND
for(Player player : game.getPlayers().values()){
if(player != null){
int count = player.getHand().size();
if(count < minCard){
minCard = count;
}
}
}
for(Player player : game.getPlayers().values()){
if(player != null){
TargetCardInHand target = new TargetCardInHand(minCard, new FilterCard());
target.setRequired(true);
if(target.choose(Outcome.Benefit, player.getId(), source.getId(), game)){
Cards cards = player.getHand().copy();
for(UUID cardUUID : cards){
Card card = player.getHand().get(cardUUID, game);
if(card != null && !target.getTargets().contains(cardUUID)){
player.discard(card, source, game);
}
}
}
}
}
return true;
}
@Override
public String getText(Mode mode) {
return "Each player chooses a number of lands he or she controls equal to the number of lands controlled by the player who controls the fewest, then sacrifices the rest. Players sacrifice creatures and discard cards the same way";
}
}